|
|
1.1 ! root 1: /* ! 2: * Remote date and time. ! 3: * ! 4: * Usage: datime machine ! 5: */ ! 6: #include <stdio.h> ! 7: #include "Time.h" ! 8: ! 9: main(argc, argv) ! 10: int argc; ! 11: char **argv; ! 12: { ! 13: Time time; ! 14: ! 15: if (argc != 2) { ! 16: fprintf(stderr, "Usage: %s machine\n", argv[0]); ! 17: exit(1); ! 18: } ! 19: BindTimeToMachine(argv[1]); ! 20: time = LocalTime(); ! 21: display(&time, "Local time"); ! 22: time = GMTime(); ! 23: display(&time, "GMT"); ! 24: } ! 25: ! 26: display(tp, msg) ! 27: Time *tp; ! 28: char *msg; ! 29: { ! 30: printf("%s: %d:%02d:%02d %d/%d/%d\n", ! 31: msg, tp->tm_hour, tp->tm_min, tp->tm_sec, ! 32: tp->tm_mon + 1, tp->tm_mday, tp->tm_year); ! 33: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.