Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>localtime</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
localtime

Usage

   #include <time.h>
   struct tm *localtime(time_t *stime);

   ANSI

Description

   localtime converts a time stored as a time_t value to the structure tm.
   The time_t value stime is the seconds elapsed since 00:00:00 GMT on
   January 1, 1970. This value can be obtained from the function time.
   localtime makes corrections for time zones and possible daylight savings
   time. The fields of the structure tm are:

   struct tm {

       tm_sec,         /* seconds 0..59                 */
       tm_min,         /* minutes 0..59                 */
       tm_hour,        /* hour of day 0..23             */
       tm_mday,        /* day of month 1..31            */
       tm_mon,         /* month 0..11                   */
       tm_year,        /* years since 1900              */
       tm_wday,        /* day of week, 0..6 (Sun..Sat)  */
       tm_yday,        /* day of year, 0..365           */
       tm_isdst;       /* >0 if daylight savings time   */
                       /* ==0 if not DST, <0 don't know */
   };

Return Value

   localtime returns a pointer to a static structure tm which is overwritten
   by each call to localtime().

Example 

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

   int main()
   {
       struct tm *t;
       time_t ltime;
       time(&ltime);
       t = localtime(&ltime);
       printf("The date is %d-%d-%d\n", t->tm_mday, t->tm_mon+1, t->tm_year);
       return EXIT_SUCCESS;
   }

See Also

   time, asctime, ctime, mktime



See Also: time asctime ctime mktime

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson