home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / cstart10.zip / cstart.c next >
C/C++ Source or Header  |  1996-06-10  |  868b  |  31 lines

  1. #define INCL_DOSFILEMGR
  2. #define INCL_DOSMISC
  3. #include <os2.h>
  4. #include <time.h>
  5. #include <sys/video.h>
  6.  
  7.  
  8. ULONG getdata(ULONG whichone)
  9. {
  10.     ULONG temp;
  11.     DosQuerySysInfo ( whichone,  whichone,  &temp,  4);
  12.     return temp;
  13. }
  14. void main(void)
  15. {
  16.     struct tm *tim;
  17.     ULONG currtime,difftime,uptime;
  18.     v_init();
  19.     currtime=getdata(QSV_TIME_LOW);
  20.     uptime=getdata(QSV_MS_COUNT);
  21.     difftime=currtime-uptime/1000;
  22.     tim=localtime(&difftime);
  23.     v_attrib(0x3);
  24.     v_printf("This computer started at (about): ");
  25.     v_attrib(0xB);
  26.     v_printf("%02u-%02u-%02u  %02u:%02u:%02u\n",tim->tm_year,tim->tm_mon+1,tim->tm_mday,tim->tm_hour,tim->tm_min,tim->tm_sec);
  27.     v_attrib(0x3);
  28.     v_printf("Current uptime: ");
  29.     v_attrib(0xB);
  30.     v_printf("%lud %luh %lum %lus %lums\n",(uptime/(1000*3600*24))%365,(uptime/(1000*3600))%24,(uptime/(1000*60))%60,(uptime/(1000))%60,uptime%1000);
  31. }