home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / vttime.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  856b  |  39 lines

  1.  
  2.  
  3. /************************************************************************
  4.  
  5. This program queries the system clock and issues a VT series 
  6. time. 
  7.  
  8. VT CSI hr ; mm , p
  9.  
  10. WY ESC c 8 hr mm
  11.  
  12. TVI ESC SP 1 ampm hr min
  13. ************************************************************************/
  14.  
  15.  
  16. #include <time.h>
  17. #include <stdio.h>
  18.  
  19. int main()
  20. {
  21.     struct tm *newtime;
  22.     time_t ltime;
  23.  
  24.     printf("Setting VT terminal clock ...\n"); 
  25.     time(<ime);
  26.     newtime = localtime(<ime);
  27.     printf("Time now: %d:%.2d:%.2d\n",newtime->tm_hour,         
  28.                newtime->tm_min,newtime->tm_sec);
  29.     if ( newtime->tm_sec != 0 ) {
  30.     sleep( 60 - newtime->tm_sec ) ;
  31.         newtime->tm_min += 1 ;
  32.     }
  33.     printf("%c[%d;%d,p",27,newtime->tm_hour,newtime->tm_min);
  34.     printf("Time set to %d:%.2d:00\n",newtime->tm_hour,newtime->tm_min);
  35.     return 0;
  36.  }
  37.  
  38.  
  39.