home *** CD-ROM | disk | FTP | other *** search
- /*
- * daytime.c - a demonstration program to read and
- * interpret the DOS CLOCK$ driver
- * Written by M. L. Lesser, 11/7/91, for Borland C
- * (Use pragma to pack structures
- * if compiling with MS C)
- */
-
- #include <stdio.h>
- #include <io.h>
- #include <fcntl.h>
- #include <sys\stat.h>
-
- int handle;
- typedef unsigned char byte;
-
- struct {
- int days;
- byte minutes;
- byte hours;
- byte hundsecs;
- byte seconds;
- } today;
-
- void main()
- {
- handle = open("CLOCK$",O_RDONLY | O_BINARY);
- read(handle,&today,6);
- close(handle);
- printf("There have been %d days since 1-1-80\n",today.days);
- printf("The time of day is %02d:%02d:%02d.%02d\n",
- today.hours,today.minutes,today.seconds,today.hundsecs);
- }
-