ltime

Returns the current local (not UTC) time

Local Servers:nonblocking
Remote Servers:N/A
NetWare:4.x, 5.x, 6.x
Service:Time/Date Manipulation

Syntax

  #include <time.h>  
   
  time_t ltime (  
     time_t  *timer);
  

Parameters

timer
(OUT) Points to the object into which the encoded local time—whose type is identical to that of time—has been placed. If timer is not NULL, the current local time is also stored in the object pointed to by this parameter.

Return Values

Returns the current local time encoded into the time_t structure.

Remarks

ltime is the local equivalent of time and includes adjustments for daylight-savings time (if it is implemented and active for the current locale). The time is encoded and represents the time in seconds since January 1, 1970 at 00:00:00. Note that a corrupted calendar time is returned, since time_t holds the calendar or UTC time. ltime returns the local time expressed in a scalar that can be stored; however, this value should not be passed to any other time function.

To retrieve the offset, in seconds, for the current locale from the UTC time and have it adjusted for daylight-savings time, use the following:

  offset = difftime(ltime(NULL), time(NULL));
  

See Also

difftime, time