Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>ftime() get current system time as structure</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ftime()                  Get Current System Time as Structure

 #include   <sys\types.h>
 #include   <timeb.h>

 void           ftime(timeptr);
 struct timeb   *timeptr;                Structure defined in <sys\timeb.h>

    ftime() gets the current time and stores it in the structure pointed
    to by 'timeptr'. The 'timeb' structure is defined in <sys\timeb.h>.
    It contains four fields, with the following values:

        'time'      The time in seconds since 00:00:00 Greenwich mean
                    time, January 1, 1970.

        'millitm'   Fraction of a second in milliseconds.

        'timezone'  The difference in minutes (moving westward) between
                    Greenwich mean time and local time.  It is set from
                    the global variable 'timezone' (see tzset()).

        'dstflag'   Nonzero if daylight saving time is set from the
                    global variable 'daylight' (see tzset()).

    Returns:    The values in fields of the structure pointed to by
                'timeptr'. The function itself does not return a value.


  -------------------------------- Example ---------------------------------

    The following statements get the elapsed time and convert it to a
    character string.

          #include <sys\types.h>
          #include <sys\timeb.h>
          #include <time.h>
          #include <stdio.h>

          struct timeb elapstime;
          char *timestr;

          main()
          {
              ftime(&elapstime);
              timestr = ctime(&(elapstime.time));
           }

See Also: asctime() ctime() time() tzset()

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