+++ /dev/null
-/** @file\r
- The header <time.h> defines two macros, and declares several types and\r
- functions for manipulating time. Many functions deal with a calendar time\r
- that represents the current date (according to the Gregorian calendar) and\r
- time. Some functions deal with local time, which is the calendar time\r
- expressed for some specific time zone, and with Daylight Saving Time, which\r
- is a temporary change in the algorithm for determining local time. The local\r
- time zone and Daylight Saving Time are implementation-defined.\r
-\r
- The macros defined are NULL; and CLOCKS_PER_SEC which expands to an\r
- expression with type clock_t (described below) that is the number per second\r
- of the value returned by the clock function.\r
-\r
- The types declared are size_t along with clock_t and time_t which are\r
- arithmetic types capable of representing times; and struct tm which holds\r
- the components of a calendar time, called the broken-down time.\r
-\r
- The range and precision of times representable in clock_t and time_t are\r
- implementation-defined. The tm structure shall contain at least the following\r
- members, in any order. The semantics of the members and their normal ranges\r
- are expressed in the comments.\r
- - int tm_sec; // seconds after the minute - [0, 60]\r
- - int tm_min; // minutes after the hour - [0, 59]\r
- - int tm_hour; // hours since midnight - [0, 23]\r
- - int tm_mday; // day of the month - [1, 31]\r
- - int tm_mon; // months since January - [0, 11]\r
- - int tm_year; // years since 1900\r
- - int tm_wday; // days since Sunday - [0, 6]\r
- - int tm_yday; // days since January 1 - [0, 365]\r
- - int tm_isdst; // Daylight Saving Time flag\r
-\r
- The value of tm_isdst is positive if Daylight Saving Time is in effect, zero\r
- if Daylight Saving Time is not in effect, and negative if the information\r
- is not available.\r
-\r
- The following macros are defined in this file:<BR>\r
- @verbatim\r
- NULL\r
- CLOCKS_PER_SEC The number of values per second returned by the clock function.\r
- @endverbatim\r
-\r
- The following types are defined in this file:<BR>\r
- @verbatim\r
- size_t Unsigned integer type of the result of the sizeof operator.\r
- clock_t Arithmetic type capable of representing a time from the clock function.\r
- time_t Arithmetic type capable of representing a time.\r
- struct tm Holds the components of a calendar time; or broken-down time.\r
- @endverbatim\r
-\r
- The following functions are declared in this file:<BR>\r
- @verbatim\r
- ############### Time Manipulation Functions\r
- clock_t clock (void);\r
- double difftime (time_t time1, time_t time0);\r
- time_t mktime (struct tm *timeptr);\r
- time_t time (time_t *timer);\r
-\r
- ################# Time Conversion Functions\r
- char * asctime (const struct tm *timeptr);\r
- char * ctime (const time_t *timer);\r
- struct tm * gmtime (const time_t *timer);\r
- time_t timegm (struct tm*);\r
- struct tm * localtime (const time_t *timer);\r
- size_t strftime (char * __restrict s, size_t maxsize,\r
- const char * __restrict format,\r
- const struct tm * __restrict timeptr);\r
- char * strptime (const char *, const char * format, struct tm*);\r
- @endverbatim\r
-\r
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available under\r
- the terms and conditions of the BSD License that accompanies this distribution.\r
- The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#ifndef _TIME_H\r
-#define _TIME_H\r
-#include <sys/EfiCdefs.h>\r
-\r
-#define CLOCKS_PER_SEC __getCPS()\r
-\r
-#ifdef _EFI_SIZE_T_\r
- typedef _EFI_SIZE_T_ size_t;\r
- #undef _EFI_SIZE_T_\r
- #undef _BSD_SIZE_T_\r
-#endif\r
-\r
-#ifdef _EFI_CLOCK_T\r
- /** An arithmetic type capable of representing values returned by clock(); **/\r
- typedef _EFI_CLOCK_T clock_t;\r
- #undef _EFI_CLOCK_T\r
-#endif\r
-\r
-#ifdef _EFI_TIME_T\r
- /** An arithmetic type capable of representing values returned as calendar time\r
- values, such as that returned by mktime();\r
- **/\r
- typedef _EFI_TIME_T time_t;\r
- #undef _EFI_TIME_T\r
-#endif\r
-\r
-/** Value added to tm_year to get the full year value. TM_YEAR_BASE + 110 --> 2010 **/\r
-#define TM_YEAR_BASE 1900\r
-\r
-/** @{\r
- Values for the tm_wday member of struct tm.\r
-**/\r
-#define TM_SUNDAY 0\r
-#define TM_MONDAY 1\r
-#define TM_TUESDAY 2\r
-#define TM_WEDNESDAY 3\r
-#define TM_THURSDAY 4\r
-#define TM_FRIDAY 5\r
-#define TM_SATURDAY 6\r
-/*@}*/\r
-\r
-/** @{\r
- Values for the tm_mon member of struct tm.\r
-**/\r
-#define TM_JANUARY 0\r
-#define TM_FEBRUARY 1\r
-#define TM_MARCH 2\r
-#define TM_APRIL 3\r
-#define TM_MAY 4\r
-#define TM_JUNE 5\r
-#define TM_JULY 6\r
-#define TM_AUGUST 7\r
-#define TM_SEPTEMBER 8\r
-#define TM_OCTOBER 9\r
-#define TM_NOVEMBER 10\r
-#define TM_DECEMBER 11\r
-/*@}*/\r
-\r
-/** A structure holding the components of a calendar time, called the\r
- broken-down time. The first nine (9) members are as mandated by the\r
- C95 standard. Additional fields have been added for EFI support.\r
-**/\r
-struct tm {\r
- int tm_year; // years since 1900\r
- int tm_mon; // months since January [0, 11]\r
- int tm_mday; // day of the month [1, 31]\r
- int tm_hour; // hours since midnight [0, 23]\r
- int tm_min; // minutes after the hour [0, 59]\r
- int tm_sec; // seconds after the minute [0, 60]\r
- int tm_wday; // days since Sunday [0, 6]\r
- int tm_yday; // days since January 1 [0, 365]\r
- int tm_isdst; // Daylight Saving Time flag\r
- int tm_zoneoff; // EFI TimeZone offset, -1440 to 1440 or 2047\r
- int tm_daylight; // EFI Daylight flags\r
- UINT32 tm_Nano; // EFI Nanosecond value\r
-};\r
-\r
-/* ############### Time Manipulation Functions ########################## */\r
-\r
-/** The clock function determines the processor time used.\r
-\r
- @return The clock function returns the implementation's best\r
- approximation to the processor time used by the program since the\r
- beginning of an implementation-defined era related only to the\r
- program invocation. To determine the time in seconds, the value\r
- returned by the clock function should be divided by the value of\r
- the macro CLOCKS_PER_SEC. If the processor time used is not\r
- available or its value cannot be represented, the function\r
- returns the value (clock_t)(-1).\r
-**/\r
-clock_t clock(void);\r
-\r
-/** Compute the difference between two calendar times: time1 - time0.\r
-\r
- @param[in] time1 An arithmetic calendar time.\r
- @param[in] time2 Another arithmetic calendar time.\r
-\r
- @return The difference between the two times expressed in seconds.\r
-**/\r
-double difftime(time_t time1, time_t time0);\r
-\r
-/** Convert a broken-down time into an arithmetic calendar time.\r
-\r
- The mktime function converts the broken-down time, expressed as local time,\r
- in the structure pointed to by timeptr into a calendar time value with the\r
- same encoding as that of the values returned by the time function. The\r
- original values of the tm_wday and tm_yday components of the structure are\r
- ignored, and the original values of the other components are not\r
- restricted to the ranges indicated above. On successful completion,\r
- the values of the tm_wday and tm_yday components of the structure are set\r
- appropriately, and the other components are set to represent the specified\r
- calendar time, but with their values forced to the ranges indicated above;\r
- the final value of tm_mday is not set until tm_mon and tm_year\r
- are determined.\r
-\r
- @param[in] timeptr Pointer to a broken-down time to be converted.\r
-\r
- @return The mktime function returns the specified calendar time encoded\r
- as a value of type time_t. If the calendar time cannot be\r
- represented, the function returns the value (time_t)(-1).\r
-**/\r
-time_t mktime(struct tm *timeptr);\r
-\r
-/** The time function determines the current calendar time.\r
-\r
- The encoding of the value is unspecified and undocumented.\r
-\r
- @param[out] timer An optional pointer to an object in which to\r
- store the calendar time.\r
-\r
- @return The time function returns the implementation's best approximation\r
- of the current calendar time. The value (time_t)(-1) is returned\r
- if the calendar time is not available. If timer is not a null\r
- pointer, the return value is also assigned to the object it\r
- points to.\r
-**/\r
-time_t time(time_t *timer);\r
-\r
-/* ################# Time Conversion Functions ########################## */\r
-\r
-/** The asctime function converts the broken-down time in the structure pointed\r
- to by timeptr into a string in the form<BR>\r
- @verbatim\r
- Sun Sep 16 01:03:52 1973\n\0\r
- @endverbatim\r
-\r
- @param[in] timeptr A pointer to a broken-down time to convert.\r
-\r
- @return The asctime function returns a pointer to the string.\r
-**/\r
-char * asctime(const struct tm *timeptr);\r
-\r
-/** The ctime function converts the calendar time pointed to by timer to a local\r
- time in the form of a string. It is equivalent to asctime(localtime(timer))\r
-\r
- @param[in] timer Pointer to a calendar time value to convert into a\r
- string representation.\r
-\r
- @return The ctime function returns the pointer returned by the asctime\r
- function with that broken-down time as argument.\r
-**/\r
-char * ctime(const time_t *timer);\r
-\r
-/** The gmtime function converts the calendar time pointed to by timer into a\r
- broken-down time, expressed as UTC.\r
-\r
- @param[in] timer Pointer to a calendar time value to convert into a\r
- broken-down time.\r
-\r
- @return The gmtime function returns a pointer to the broken-down time,\r
- or a null pointer if the specified time cannot be converted to UTC.\r
-**/\r
-struct tm * gmtime(const time_t *timer);\r
-\r
-/** The timegm function is the opposite of gmtime.\r
-\r
- @param[in] tm Pointer to a broken-down time to convert into a\r
- calendar time.\r
-\r
- @return The calendar time expressed as UTC.\r
-**/\r
-time_t timegm(struct tm*);\r
-\r
-/** The localtime function converts the calendar time pointed to by timer into\r
- a broken-down time, expressed as local time.\r
-\r
- @param[in] timer Pointer to a calendar time value to be converted.\r
-\r
- @return The localtime function returns a pointer to the broken-down time,\r
- or a null pointer if the specified time cannot be converted to\r
- local time.\r
-**/\r
-struct tm * localtime(const time_t *timer);\r
-\r
-/** The strftime function places characters into the array pointed to by s as\r
- controlled by the string pointed to by format. The format shall be a\r
- multibyte character sequence, beginning and ending in its initial shift\r
- state. The format string consists of zero or more conversion specifiers\r
- and ordinary multibyte characters. A conversion specifier consists of\r
- a % character, possibly followed by an E or O modifier character\r
- (described below), followed by a character that determines the behavior of\r
- the conversion specifier.\r
-\r
- All ordinary multibyte characters (including the terminating null\r
- character) are copied unchanged into the array. If copying takes place\r
- between objects that overlap, the behavior is undefined. No more than\r
- maxsize characters are placed into the array. 3 Each conversion specifier\r
- is replaced by appropriate characters as described in the following list.\r
- The appropriate characters are determined using the LC_TIME category of\r
- the current locale and by the values of zero or more members of the\r
- broken-down time structure pointed to by timeptr, as specified in brackets\r
- in the description. If any of the specified values is outside the normal\r
- range, the characters stored are unspecified.\r
-\r
- %a is replaced by the locale's abbreviated weekday name. [tm_wday]\r
- %A is replaced by the locale's full weekday name. [tm_wday]\r
- %b is replaced by the locale's abbreviated month name. [tm_mon]\r
- %B is replaced by the locale's full month name. [tm_mon]\r
- %c is replaced by the locale's appropriate date and time representation.\r
- %C is replaced by the year divided by 100 and truncated to an integer,\r
- as a decimal number (00-99). [tm_year]\r
- %d is replaced by the day of the month as a decimal number (01-31). [tm_mday]\r
- %D is equivalent to "%m/%d/%y". [tm_mon, tm_mday, tm_year]\r
- %e is replaced by the day of the month as a decimal number (1-31);\r
- a single digit is preceded by a space. [tm_mday]\r
- %F is equivalent to "%Y-%m-%d" (the ISO 8601 date format).\r
- [tm_year, tm_mon, tm_mday]\r
- %g is replaced by the last 2 digits of the week-based year (see below) as\r
- a decimal number (00-99). [tm_year, tm_wday, tm_yday]\r
- %G is replaced by the week-based year (see below) as a decimal number\r
- (e.g., 1997). [tm_year, tm_wday, tm_yday]\r
- %h is equivalent to "%b". [tm_mon]\r
- %H is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]\r
- %I is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]\r
- %j is replaced by the day of the year as a decimal number (001-366). [tm_yday]\r
- %m is replaced by the month as a decimal number (01-12). [tm_mon]\r
- %M is replaced by the minute as a decimal number (00-59). [tm_min]\r
- %n is replaced by a new-line character.\r
- %p is replaced by the locale's equivalent of the AM/PM designations\r
- associated with a 12-hour clock. [tm_hour]\r
- %r is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]\r
- %R is equivalent to "%H:%M". [tm_hour, tm_min]\r
- %S is replaced by the second as a decimal number (00-60). [tm_sec]\r
- %t is replaced by a horizontal-tab character.\r
- %T is equivalent to "%H:%M:%S" (the ISO 8601 time format).\r
- [tm_hour, tm_min, tm_sec]\r
- %u is replaced by the ISO 8601 weekday as a decimal number (1-7),\r
- where Monday is 1. [tm_wday]\r
- %U is replaced by the week number of the year (the first Sunday as the\r
- first day of week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]\r
- %V is replaced by the ISO 8601 week number (see below) as a decimal number\r
- (01-53). [tm_year, tm_wday, tm_yday]\r
- %w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.\r
- [tm_wday]\r
- %W is replaced by the week number of the year (the first Monday as the\r
- first day of week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]\r
- %x is replaced by the locale's appropriate date representation.\r
- %X is replaced by the locale's appropriate time representation.\r
- %y is replaced by the last 2 digits of the year as a decimal\r
- number (00-99). [tm_year]\r
- %Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]\r
- %z is replaced by the offset from UTC in the ISO 8601 format "-0430"\r
- (meaning 4 hours 30 minutes behind UTC, west of Greenwich), or by no\r
- characters if no time zone is determinable. [tm_isdst]\r
- %Z is replaced by the locale's time zone name or abbreviation, or by no\r
- characters if no time zone is determinable. [tm_isdst]\r
- %% is replaced by %.\r
-\r
- Some conversion specifiers can be modified by the inclusion of an E or O\r
- modifier character to indicate an alternative format or specification.\r
- If the alternative format or specification does not exist for the current\r
- locale, the modifier is ignored. %Ec is replaced by the locale's\r
- alternative date and time representation.\r
-\r
- %EC is replaced by the name of the base year (period) in the locale's\r
- alternative representation.\r
- %Ex is replaced by the locale's alternative date representation.\r
- %EX is replaced by the locale's alternative time representation.\r
- %Ey is replaced by the offset from %EC (year only) in the locale's\r
- alternative representation.\r
- %EY is replaced by the locale's full alternative year representation.\r
- %Od is replaced by the day of the month, using the locale's alternative\r
- numeric symbols (filled as needed with leading zeros, or with leading\r
- spaces if there is no alternative symbol for zero).\r
- %Oe is replaced by the day of the month, using the locale's alternative\r
- numeric symbols (filled as needed with leading spaces).\r
- %OH is replaced by the hour (24-hour clock), using the locale's\r
- alternative numeric symbols.\r
- %OI is replaced by the hour (12-hour clock), using the locale's\r
- alternative numeric symbols.\r
- %Om is replaced by the month, using the locale's alternative numeric symbols.\r
- %OM is replaced by the minutes, using the locale's alternative numeric symbols.\r
- %OS is replaced by the seconds, using the locale's alternative numeric symbols.\r
- %Ou is replaced by the ISO 8601 weekday as a number in the locale's\r
- alternative representation, where Monday is 1.\r
- %OU is replaced by the week number, using the locale's alternative numeric symbols.\r
- %OV is replaced by the ISO 8601 week number, using the locale's alternative\r
- numeric symbols.\r
- %Ow is replaced by the weekday as a number, using the locale's alternative\r
- numeric symbols.\r
- %OW is replaced by the week number of the year, using the locale's\r
- alternative numeric symbols.\r
- %Oy is replaced by the last 2 digits of the year, using the locale's\r
- alternative numeric symbols.\r
-\r
- %g, %G, and %V give values according to the ISO 8601 week-based year. In\r
- this system, weeks begin on a Monday and week 1 of the year is the week\r
- that includes January 4th, which is also the week that includes the first\r
- Thursday of the year, and is also the first week that contains at least\r
- four days in the year. If the first Monday of January is the 2nd, 3rd, or\r
- 4th, the preceding days are part of the last week of the preceding year;\r
- thus, for Saturday 2nd January 1999, %G is replaced by 1998 and %V is\r
- replaced by 53. If December 29th, 30th, or 31st is a Monday, it and any\r
- following days are part of week 1 of the following year. Thus, for Tuesday\r
- 30th December 1997, %G is replaced by 1998 and %V is replaced by 01.\r
-\r
- If a conversion specifier is not one of the above, the behavior is undefined.\r
-\r
- In the "C" locale, the E and O modifiers are ignored and the replacement\r
- strings for the following specifiers are:\r
- %a the first three characters of %A.\r
- %A one of "Sunday", "Monday", ... , "Saturday".\r
- %b the first three characters of %B.\r
- %B one of "January", "February", ... , "December".\r
- %c equivalent to "%a %b %e %T %Y".\r
- %p one of "AM" or "PM".\r
- %r equivalent to "%I:%M:%S %p".\r
- %x equivalent to "%m/%d/%y".\r
- %X equivalent to %T.\r
- %Z implementation-defined.\r
-\r
- @param s Pointer to the buffer in which to store the result.\r
- @param maxsize Maximum number of characters to put into buffer s.\r
- @param format Format string, as described above.\r
- @param timeptr Pointer to a broken-down time structure containing the\r
- time to format.\r
-\r
- @return If the total number of resulting characters including the\r
- terminating null character is not more than maxsize, the\r
- strftime function returns the number of characters placed into\r
- the array pointed to by s not including the terminating null\r
- character. Otherwise, zero is returned and the contents of the\r
- array are indeterminate.\r
-**/\r
-size_t strftime( char * __restrict s, size_t maxsize,\r
- const char * __restrict format,\r
- const struct tm * __restrict timeptr);\r
-\r
-char *strptime(const char *, const char * format, struct tm*);\r
-\r
-\r
-/* ################# Implementation Functions ########################### */\r
-\r
-clock_t __getCPS(void);\r
-\r
-#endif /* _TIME_H */\r