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 6.0 - <b>_dos_settime() set the system time</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _dos_settime()          Set the system time

 #include   <dos.h>

  unsigned     _dos_settime(time);
  struct dostime_t *time;     Location of information about new time

    _dos_settime() uses MS-DOS function 2Dh to set the current system
    time. Before calling _dos_settime(), the new time must be stored in
    struct dostime_t, defined in dos.h:

           struct dostime_t {
              unsigned char hour;       0-23
              unsigned char minute;     0-59
              unsigned char second;     0-59
              unsigned char hsecond;    0-99 (hundreths of a second)
              }

    Returns:    _dos_settime() returns 0 if successful, otherwise it
                returns a nonzero value and sets errno to EINVAL to
                indicate that an invalid time was specified.

   Portability:     MS-DOS only, version 1.0 or higher

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

 This program sets the system time to 2:30 pm

           #include <dos.h>

           main()
           {
              struct dostime_t time;

              time.hour = 14;
              time.minute = 30;
              time.second = 0;
              time.hsecond = 0;

              if (_dos_settime(&time) == 0)
                 printf("The new time is %d:%d:%d\n", time.hour, time.minute,
           time.second);
              else
                 printf("Invalid time specified");
           }


See Also: _dos_gettime() _dos_setdate()

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