localtime
struct tm *  localtime ( const time_t * timer );
time.h
  cplusplus.com  

Convert time_t value to tm structure as local time.
  Converts timer to tm structure adjusting to the local time zone.

Parameters.

timer
pointer to a time_t value, usually returned by time function.

Return Value.
  A pointer to a tm structure.
  This structure is statically allocated and shared by gmtime, localtime and ctime functions. Each time one of these functions is called the content of the structure is overwritten.

Portability.
  Defined in ANSI-C.

Example.

/* localtime example */
#include <stdio.h>
#include <time.h>

main ()
{
  time_t rawtime;
  struct tm * timeinfo;

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );
  printf ( "Current date and time are: %s", asctime (timeinfo) );
  
  return 0;
}
Output:
Current date and time are: Sat May 20 17:36:17 2000

See also.
  asctime, ctime, localtime, mktime, time


© The C++ Resources Network, 2000