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
|
/* settime.ccc -- Misosys C program to set time using xtrs emulator traps */
/* Copyright (c) 1997, Timothy Mann */
/* $Id: settime.ccc,v 1.3 2008/06/26 04:39:56 mann Exp $ */
/* 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. */
#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");
}
|