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 <dos.h>
    unsigned _dos_settime( struct dostime_t *time );
    struct dostime_t {
            unsigned char hour;     /* 0-23 */
            unsigned char minute;   /* 0-59 */
            unsigned char second;   /* 0-59 */
            unsigned char hsecond;  /* 1/100 second; 0-99 */
    };

Description:
    The _dos_settime function uses system call 0x2D to set the current
    system time.  The time information is passed in a  dostime_t structure
    pointed to by time.

Returns:
    The _dos_settime function returns zero if successful.  Otherwise, it
    returns a non-zero value and sets  errno to  EINVAL indicating that an
    invalid time was given.

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

    void main()
      {
        struct dosdate_t date;
        struct dostime_t time;

        /* Get and display the current date and time */
        _dos_getdate( &date );
        _dos_gettime( &time );
        printf( "The date (MM-DD-YYYY) is: %d-%d-%d\n",
            date.month, date.day, date.year );
        printf( "The time (HH:MM:SS) is: %.2d:%.2d:%.2d\n",
            time.hour, time.minute, time.second );

        /* Change it to the turn of the century */
        date.year = 1999;
        date.month = 12;
        date.day = 31;
        time.hour = 23;
        time.minute = 59;
        _dos_setdate( &date );
        _dos_settime( &time );
        printf( "New date (MM-DD-YYYY) is: %d-%d-%d\n",
                      date.month, date.day, date.year );
        printf( "New time (HH:MM:SS) is: %.2d:%.2d:%.2d\n",
                      time.hour, time.minute, time.second );
      }

    produces the following:

    The date (MM-DD-YYYY) is: 12-25-1989
    The time (HH:MM:SS) is: 14:23:15
    New date (MM-DD-YYYY) is: 12-31-1999
    New time (HH:MM:SS) is: 23:59:16

Classification:
    DOS

Systems:
    DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32, DOS/PM

See Also:
    _dos_getdate, _dos_setdate, _dos_gettime, gmtime, localtime, mktime,
    time

See Also: _dos_getdate _dos_setdate

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