localtime, localtime_r

Converts calendar time to local time

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:Time/Date Manipulation

Syntax

  #include <time.h>  
   
  struct tm *localtime  (  
     const time_t  *timer);
  
  #include <time.h>  
   
  struct tm *localtime_r  (  
     const time_t  *timer,  
     struct tm     *timeP);
  

Parameters

timer
(IN) Points to the calendar time to convert into the tm structure.
timeP
(OUT) Points to the converted string.

Return Values

Returns a pointer to the tm structure containing the time information.

Remarks

localtime, localtime_r converts the calendar time pointed to by the timer parameter into a structure of time information expressed as local time.

The calendar time (Coordinated Universal Time) is usually obtained by calling the time function.

Use the NetWare console command SET TIME to set the date and time kept by the server. Refer to the NetWare 386 System Administration manual for more information on this command.

The structure returned is reused every time that localtime is called.

localtime_r requires the caller to pass storage for the results rather than relying on per-thead data. localtime_r is supported only in CLIB V 4.11 or above.

localtime_r provides the same functionality as localtime, but localtime_r is designed for use with reentrant NLMs. localtime_r provides that the caller pass storage for the results rather than relying on per-thread data. localtime_r is supported only in CLIB V 4.11 or above.

See Also

asctime, asctime_r, clock, ctime, ctime_r, difftime, gmtime, gmtime_r, mktime, strftime, time

Example

  #include <stdio.h>  
  #include <time.h>  
   
  void print_time ()  
  {  
     time_t time_of_day;  
     time_of_day = time (NULL);  
     printf ("It is now: %s.Get to work.",asctime (localtime
             (&time_of_day) ) );  
  }
  

produces the following:

  It is now: Wed Mar 21 15:58:27 1990  
  .Get to work.