ltime

Returns the current local (not UTC) time.

Library:LibC
Classification:Novell
Service:Time

Syntax

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

Parameters

calendar

(OUT) Points to the object into which the encoded local time—whose type is identical to that of time—has been placed. If calendar 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.

Remarks

The ltime function 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:Note that a corrupted calendar time is returned, because time_t holds the calendar or UTC time. The ltime function 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