.TH "avr_time" 3avr "Fri Nov 24 2023 23:59:10" "Version 2.0.0" "avr-libc" \" -*- nroff -*- .ad l .nh .SH NAME avr_time \- : Time .SH SYNOPSIS .br .PP .SS "Typedefs" .in +1c .ti -1c .RI "typedef \fBuint32_t\fP \fBtime_t\fP" .br .in -1c .SH "Detailed Description" .PP .PP .nf #include .fi .PP .SS "Introduction to the Time functions" .PP This file declares the time functions implemented in \fCavr-libc\fP\&. .PP The implementation aspires to conform with ISO/IEC 9899 (C90)\&. However, due to limitations of the target processor and the nature of its development environment, a practical implementation must of necessity deviate from the standard\&. .PP Section 7\&.23\&.2\&.1 clock() The type clock_t, the macro CLOCKS_PER_SEC, and the function clock() are not implemented\&. We consider these items belong to operating system code, or to application code when no operating system is present\&. .PP Section 7\&.23\&.2\&.3 \fBmktime()\fP The standard specifies that \fBmktime()\fP should return (time_t) -1, if the time cannot be represented\&. This implementation always returns a 'best effort' representation\&. .PP Section 7\&.23\&.2\&.4 \fBtime()\fP The standard specifies that \fBtime()\fP should return (time_t) -1, if the time is not available\&. Since the application must initialize the time system, this functionality is not implemented\&. .PP Section 7\&.23\&.2\&.2, \fBdifftime()\fP Due to the lack of a 64 bit double, the function \fBdifftime()\fP returns a long integer\&. In most cases this change will be invisible to the user, handled automatically by the compiler\&. .PP Section 7\&.23\&.1\&.4 struct tm Per the standard, struct tm->tm_isdst is greater than zero when Daylight Saving time is in effect\&. This implementation further specifies that, when positive, the value of tm_isdst represents the amount time is advanced during Daylight Saving time\&. .PP Section 7\&.23\&.3\&.5 \fBstrftime()\fP Only the 'C' locale is supported, therefore the modifiers 'E' and 'O' are ignored\&. The 'Z' conversion is also ignored, due to the lack of time zone name\&. .PP In addition to the above departures from the standard, there are some behaviors which are different from what is often expected, though allowed under the standard\&. .PP There is no 'platform standard' method to obtain the current time, time zone, or daylight savings 'rules' in the AVR environment\&. Therefore the application must initialize the time system with this information\&. The functions \fBset_zone()\fP, \fBset_dst()\fP, and \fBset_system_time()\fP are provided for initialization\&. Once initialized, system time is maintained by calling the function \fBsystem_tick()\fP at one second intervals\&. .PP Though not specified in the standard, it is often expected that time_t is a signed integer representing an offset in seconds from Midnight Jan 1 1970\&.\&.\&. i\&.e\&. 'Unix time'\&. This implementation uses an unsigned 32 bit integer offset from Midnight Jan 1 2000\&. The use of this 'epoch' helps to simplify the conversion functions, while the 32 bit value allows time to be properly represented until Tue Feb 7 06:28:15 2136 UTC\&. The macros UNIX_OFFSET and NTP_OFFSET are defined to assist in converting to and from Unix and NTP time stamps\&. .PP Unlike desktop counterparts, it is impractical to implement or maintain the 'zoneinfo' database\&. Therefore no attempt is made to account for time zone, daylight saving, or leap seconds in past dates\&. All calculations are made according to the currently configured time zone and daylight saving 'rule'\&. .PP In addition to C standard functions, re-entrant versions of \fBctime()\fP, \fBasctime()\fP, \fBgmtime()\fP and \fBlocaltime()\fP are provided which, in addition to being re-entrant, have the property of claiming less permanent storage in RAM\&. An additional time conversion, \fBisotime()\fP and its re-entrant version, uses far less storage than either \fBctime()\fP or \fBasctime()\fP\&. .PP Along with the usual smattering of utility functions, such as \fBis_leap_year()\fP, this library includes a set of functions related the sun and moon, as well as sidereal time functions\&. .SH "Typedef Documentation" .PP .SS "typedef \fBuint32_t\fP \fBtime_t\fP" time_t represents seconds elapsed from Midnight, Jan 1 2000 UTC (the Y2K 'epoch')\&. Its range allows this implementation to represent time up to Tue Feb 7 06:28:15 2136 UTC\&. .SH "Author" .PP Generated automatically by Doxygen for avr-libc from the source code\&.