UTime is a subscription-based time & expense tracking software. It's simple to use and integrates with all major ERPs and payroll solutions. Shenzhen luen generation technology co., LTD. Was established in June 2008, headquarters is located in nanshan district of shenzhen software industry base.-->
Set the file modification time.
Utime.time ¶ Returns the number of seconds, as an integer, since the Epoch, assuming that underlying RTC is set and maintained as decsribed above. If an RTC is not set, this function returns number of seconds since a port-specific reference point in time (for embedded boards without a battery-backed RTC, usually since power up or reset). UTime Limited ('UTime' or the 'Company') (Nasdaq: UTME), a mobile device manufacturing company committed to providing cost effective products and solutions to consumers globally, today announced.
Pointer to a string that contains the path or filename.
Pointer to stored time values.
Each of these functions returns 0 if the file-modification time was changed. A return value of -1 indicates an error. If an invalid parameter is passed, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, these functions return -1 and errno is set to one of the following values:
|EACCES||Path specifies directory or read-only file|
|EINVAL||Invalid times argument|
|EMFILE||Too many open files (the file must be opened to change its modification time)|
|ENOENT||Path or filename not found|
See _doserrno, errno, _sys_errlist, and _sys_nerr for more information on these, and other, return codes.
The date can be changed for a file if the change date is after midnight, January 1, 1970, and before the end date of the function used. _utime and _wutime use a 64-bit time value, so the end date is 23:59:59, December 31, 3000, UTC. If _USE_32BIT_TIME_T is defined to force the old behavior, the end date is 23:59:59 January 18, 2038, UTC. _utime32 or _wutime32 use a 32-bit time type regardless of whether _USE_32BIT_TIME_T is defined, and always have the earlier end date. _utime64 or _wutime64 always use the 64-bit time type, so these functions always support the later end date.
The _utime function sets the modification time for the file specified by filename. The process must have write access to the file in order to change the time. In the Windows operating system, you can change the access time and the modification time in the _utimbuf structure. If times is a NULL pointer, the modification time is set to the current local time. Otherwise, times must point to a structure of type _utimbuf, defined in SYSUTIME.H.
The _utimbuf structure stores file access and modification times used by _utime to change file-modification dates. The structure has the following fields, which are both of type time_t:
|actime||Time of file access|
|modtime||Time of file modification|
Specific versions of the _utimbuf structure (_utimebuf32 and __utimbuf64) are defined using the 32-bit and 64-bit versions of the time type. These are used in the 32-bit and 64-bit specific versions of this function. _utimbuf itself by default uses a 64-bit time type unless _USE_32BIT_TIME_T is defined.
_utime is identical to _futime except that the filename argument of _utime is a filename or a path to a file, rather than a file descriptor of an open file.
_wutime is a wide-character version of _utime; the filename argument to _wutime is a wide-character string. These functions behave identically otherwise.
By default, this function's global state is scoped to the application. To change this, see Global state in the CRT.
|TCHAR.H routine||_UNICODE & _MBCS not defined||_MBCS defined||_UNICODE defined|
|Routine||Required headers||Optional headers|
|_utime, _utime32, _utime64||<sys/utime.h>||<errno.h>|
|_wutime||<utime.h> or <wchar.h>||<errno.h>|
For additional compatibility information, see Compatibility.
This program uses _utime to set the file-modification time to the current time.
ctime, _ctime32, _ctime64, _wctime, _wctime32, _wctime64
_fstat, _fstat32, _fstat64, _fstati64, _fstat32i64, _fstat64i32
_ftime, _ftime32, _ftime64
_futime, _futime32, _futime64
gmtime, _gmtime32, _gmtime64
localtime, _localtime32, _localtime64
_stat, _wstat Functions
time, _time32, _time64
utime module provides functions for getting the current time and date,measuring time intervals, and for delays.
Time Epoch: Unix port uses standard for POSIX systems epoch of1970-01-01 00:00:00 UTC. However, embedded ports use epoch of2000-01-01 00:00:00 UTC.
Maintaining actual calendar date/time: This requires aReal Time Clock (RTC). On systems with underlying OS (including someRTOS), an RTC may be implicit. Setting and maintaining actual calendartime is responsibility of OS/RTOS and is done outside of MicroPython,it just uses OS API to query date/time. On baremetal ports howeversystem time depends on
machine.RTC() object. The current calendar timemay be set using
machine.RTC().datetime(tuple) function, and maintainedby following means:
If actual calendar time is not maintained with a system/MicroPython RTC,functions below which require reference to current absolute time maybehave not as expected.
Convert a time expressed in seconds since the Epoch (see above) into an 8-tuple whichcontains: (year, month, mday, hour, minute, second, weekday, yearday)If secs is not provided or None, then the current time from the RTC is used.
This is inverse function of localtime. It’s argument is a full 8-tuplewhich expresses a time as per localtime. It returns an integer which isthe number of seconds since Jan 1, 2000.
Sleep for the given number of seconds. Seconds can be a floating-point number tosleep for a fractional number of seconds. Note that other MicroPython ports maynot accept floating-point argument, for compatibility with them use
Delay for given number of milliseconds, should be positive or 0.
Delay for given number of microseconds, should be positive or 0
Returns an increasing millisecond counter with arbitrary reference point,that wraps after some (unspecified) value. The value should be treated asopaque, suitable for use only with ticks_diff().
ticks_ms above, but in microseconds.
Measure period between consecutive calls to ticks_ms(), ticks_us(), or ticks_cpu().The value returned by these functions may wrap around at any time, so directlysubtracting them is not supported. ticks_diff() should be used instead. “old” value shouldactually precede “new” value in time, or result is undefined. This function should not beused to measure arbitrarily long periods of time (because ticks_*() functions wrap aroundand usually would have short period). The expected usage pattern is implementing eventpolling with timeout:
Returns the number of seconds, as an integer, since the Epoch, assuming that underlyingRTC is set and maintained as decsribed above. If an RTC is not set, this function returnsnumber of seconds since a port-specific reference point in time (for embedded boards withouta battery-backed RTC, usually since power up or reset). If you want to develop portableMicroPython application, you should not rely on this function to provide higher than secondprecision. If you need higher precision, use
ticks_us() functions,if you need calendar time,
localtime() without an argument is a better choice.
Difference to CPython
In CPython, this function returns number ofseconds since Unix epoch, 1970-01-01 00:00 UTC, as a floating-point,usually having microsecond precision. With MicroPython, only Unix portuses the same Epoch, and if floating-point precision allows,returns sub-second precision. Embedded hardware usually doesn’t havefloating-point precision to represent both long time ranges and subsecondprecision, so they use integer value with second precision. Some embeddedhardware also lacks battery-powered RTC, so returns number of secondssince last power-up or from other relative, hardware-specific point(e.g. reset).