Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <time.h>
    time_t mktime( struct tm *timeptr );

    struct  tm {
      int tm_sec;   /* seconds after the minute -- [0,61] */
      int tm_min;   /* minutes after the hour   -- [0,59] */
      int tm_hour;  /* hours after midnight     -- [0,23] */
      int tm_mday;  /* day of the month         -- [1,31] */
      int tm_mon;   /* months since January     -- [0,11] */
      int tm_year;  /* years since 1900                   */
      int tm_wday;  /* days since Sunday        -- [0,6]  */
      int tm_yday;  /* days since January 1     -- [0,365]*/
      int tm_isdst; /* Daylight Savings Time flag */
    };

Description:
    The mktime function converts the local time information in the structure
    pointed to by timeptr into a calendar time (Coordinated Universal Time)
    with the same encoding used by the  time function.  The original values
    of the fields  tm_sec,  tm_min,  tm_hour,  tm_mday, and  tm_mon are not
    restricted to ranges described for  struct tm.  If these fields are not
    in their proper ranges, they are adjusted so that they are in the proper
    ranges.  Values for the fields  tm_wday and  tm_yday are computed after
    all the other fields have been adjusted.

    If the original value of  tm_isdst is negative, this field is computed
    also.  Otherwise, a value of 0 is treated as "daylight savings time is
    not in effect" and a positive value is treated as "daylight savings time
    is in effect".

    Whenever mktime is called, the  tzset function is also called.

Returns:
    The mktime function returns the converted calendar time.

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

    static const char *week_day[] = {
        "Sunday", "Monday", "Tuesday", "Wednesday",
        "Thursday", "Friday", "Saturday"
    };

    void main()
      {
        struct tm new_year;

        new_year.tm_year  = 2001 - 1900;
        new_year.tm_mon   = 0;
        new_year.tm_mday  = 1;
        new_year.tm_hour  = 0;
        new_year.tm_min   = 0;
        new_year.tm_sec   = 0;
        new_year.tm_isdst = 0;
        mktime( &new_year );
        printf( "The next century begins on a %s\n",
                 week_day[ new_year.tm_wday ] );
      }

    produces the following:

    The next century begins on a Monday

Classification:
    ANSI

Systems:
    All, Netware

See Also:
    asctime, clock, ctime, difftime, gmtime, localtime, strftime, time,
    tzset

See Also: clock difftime

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