Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
localtime
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The localtime function converts a time stored in an object of
type time_t to a structure. The long value <timer> represents the
seconds elapsed since 00:00:00, January 1, 1970, Greenwich mean
time. This value is usually obtained from the time function.
The localtime function breaks down the <timer> value, corrects for
the local time zone and daylight saving time if appropriate, and
stores the corrected time in a structure of type tm. See the tm
structure for information about its fields.
Note that the gmtime, mktime, and localtime functions use a single
statically allocated buffer for the conversion. Each call to one
of these routines destroys the result of the previous call.
The localtime function makes corrections for the local time zone
if the user first sets the environment variable TZ. When TZ is
set, three other environment variables (timezone, daylight, and
tzname) are automatically set as well. See the tzset function for
a description of these variables.
The TZ variable is not part of the ANSI standard definition of
localtime, but is a Microsoft extension.
Return Value
The localtime function returns a pointer to the structure result.
DOS and OS/2 do not accommodate the value in dates prior to 1980.
If <timer> represents a date prior to January 1, 1980, the
function returns NULL.
-♦-