CONTENTS | INDEX | PREV | NEXT
 localtime

 NAME
  localtime - convert time into broken down time

 SYNOPSIS
  struct tm *tp = localtime(&t);
  time_t t;

 FUNCTION
  localtime takes the address of a time_t variable and breaks up
  the time into component parts, storing them in a static tm
  structure.  The address of this structure is returned.

  Since the broken up time is stored into a static structure, the
  structure will get overwritten on the next call to localtime().

  The fields of the tm structure are:

  struct tm {
      int tm_sec;     /*  0-59    */
      int tm_min;     /*  0-59    */
      int tm_hour;    /*  0-23    */
      int tm_mday;    /*  1-31    */
      int tm_mon;     /*  0-11    */
      int tm_year;    /*  n+1900  */
      int tm_wday;    /*  (sun)0-6*/
      int tm_yday;    /*  0-366   */
      int tm_isdst;   /*  daylight svings time flag (not impl by DICE) */
  };

 EXAMPLE

  /*
   *  Note that it is much easier to format time/date strings with
   *  strftime().
   */

  #include <stdio.h>
  #include <time.h>

  main()
  {
      time_t t = time(NULL);
      struct tm *tp = localtime(&t);

      printf("The time is %02d:%02d:%02dn", tp->tm_hour, tp->tm_min, tp->tm_sec);

      return(0);
  }

 INPUTS
  time_t *t;  pointer to a time_t

 RESULTS
  struct tm *tp;  pointer to a struct tm structure filled out according
          to the passed time.

 SEE ALSO
  time, asctime, strftime, ctime, clock