File: settime.ccc

package info (click to toggle)
xtrs 4.9c-3.2
  • links: PTS
  • area: contrib
  • in suites: squeeze
  • size: 2,236 kB
  • ctags: 1,431
  • sloc: ansic: 19,941; makefile: 248; csh: 132; sh: 129
file content (30 lines) | stat: -rw-r--r-- 941 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* settime.ccc -- Misosys C program to set time using xtrs emulator traps */
/* Copyright (c) 1997, Timothy Mann */

/* This software may be copied, modified, and used for any purpose
 * without fee, provided that (1) the above copyright notice is
 * retained, and (2) modified versions are clearly marked as having
 * been modified, with the modifier's name and the date included.  */

/* Last modified on Sat Sep 20 13:41:00 PDT 1997 by mann */

#option redirect 0
#include "xtrsemt.h"
#include "xtrsemt.ccc"  /* could use separate compilation instead */

main()
{
    time_t now;
    struct tm *nowtm;
    char cmd[81];

    now = emt_time(EMT_TIME_LOCAL);
    nowtm = localtime(&now);
    sprintf(cmd, "date %02d/%02d/%02d",
	    nowtm->tm_mon + 1, nowtm->tm_mday, nowtm->tm_year % 100);
    system(cmd);
    sprintf(cmd, "time %02d:%02d:%02d", 
	    nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec);
    system(cmd);
    system("time");
}