Local Time with secondsTime with seconds
local time (const times_t *clock); The localtime() functions convert a time in seconds since the epoch (00:00:00 GMT, January 1, 1970) into a downtime, in local time. Adjusts the time zones and any seasonals. Use local time zoning information as if localtime() is calling tzset().
One side effect of invoking localtime() is that the globals zname, time zone and Daylight are seeded from the value of the TZ environmental tag, just as if the tzset() command had been used. Returns the tm tree at the local time specified by TZ. It is not re-entrant; see localtime_r() for a re-entrant state.
This is the time to convert. If successful, the localtime() will return a cursor to a statical tree containing the decoding time. Sharing this statical buffers with gmtime(), following invocations of localtime() or gmtime() override it. For more information about how to set time zones, see tzset().
localtime(3) - Linux manual page
Each of the function ctime(), gmtime() and localtime() assumes an argument of the datatype time_t, which stands for the time of the calender. In interpreting it as actual time, it is the number of seconds that have passed since the epoch, 1970-01-01-01 00:00:00:00 +0000 (UTC). Tasks asctime() and mktime() both assume an Argument that shows the divided time, i.e. a presentation divided into year, months, days and so on.
The downtime is saved in the tm tree tm, which is specified in as follows: The number of seconds after the minutes, usually in the interval from 0 to 59, but can be up to 60 to allow switching seconds. An indicator that indicates whether summer time is effective at the time described.
This value is set to zero if it does not exist, and to zero if the information is not available. Turns the date period into a zero date character sequence of the type "Wed Jun 30 21:49:08 1993\n". The weekday acronyms are " Sun", "Mon", "Tue", "Wed", "Thu", "Fri" and "Sat".
Returns a static character sequence that can be replaced by one of the following date and time callbacks. Also, the feature resets the variable name, time zone and light (see tzset(3)) with information about the actual time zone. There is no need to adjust time zone, date and time.
Using the gmtime() command, you can convert the calender time into a Coordinated Universal Time (UTC) time. Returns a static assigned structure that can be replaced by one of the date and time callbacks. Using gmtime_r() does the same, but saves the information in a user-defined structure.
For example, the localtime() functions transforms the calendaring time into a time display expressing the time zone specified by the users. It behaves like tzset(3) and resets the tzsname variable with information about the actual time zone, time zone with the differential between Coordinated Universal Time (UTC) and local default time in seconds and sunlight to a value other than zero if the summer time rule applies during part of the year.
Returns a static assigned structure that can be replaced by one of the date and time callbacks. Localtime_r () does the same, but saves the files in a structure provided by the users. There is no need to adjust time zone, date and time. Increment () transforms the resolved time value tm into a null-terminated character with the same encoding as ctime().
Returns a static character sequence that can be replaced by one of the following date and time callbacks. Asctime_r( ) does the same, but saves the character chain in a user-provided buffers that should hold at least 26 byte. Convert a subdivided time frame, in local time terms, to a calendaring time display using the mktime() method.
will ignore the value specified by the calling program in the boxes tm_wday and tm_yday. A value specified in the tm_isdst box tells mktime() whether DST is effective for the time specified in the tm tree or not: a plus value means DST is effective; zero means DST is not effective; and a minus value means mktime() should try (use time zone information and system database to determine) whether DST is effective at the specified time.
tm_wday and tm_yday are reset to default value derived from the content of the other arrays; if members of the array are outside their current range, they are reset to normal (e.g. October 40 to November 9); tm_isdst is reset to a plus value (regardless of its starting value) or 0 to indicate whether DST is effective or not at the specified time.
The call to mktime() also set the extern tag azname with information about the actual time zone. When the specified breakdown time cannot be displayed as calendaring time (seconds since the epoch), mktime() (time_t) will return -1 and not change the elements of the breakdown timestruct. Any of these function will return the described value, or NULL (-1 in the case of mktime()) if an exception is noticed.
specificate aspects of asctime(), ctime(), gmtime(), localtime() and mktime(). Four function asctime(), ctime(), gmtime() and localtime() give back a pointers to statical datas and are therefore not thread-safe. Asctime_r( ), ctime_r(), gmtime_r() and localtime_r() thread-safe releases are specified by SUSv2 and have been available since libc 5.2.5. The 1-2001 says: "The function asctime(), ctime(), gmtime() and localtime() should give back a value in one of two fixed objects: a split time tree and an arrays of character types.
Executing one of the operations can override the information returning in one of these entities with one of the other operations. 1-2004, localtime() must act as if tzset(3) was invoked, while localtime_r() does not have this request. To make portablen coding tzset(3) should be invoked before localtime_r().