| plan 9 kernel history: overview | file list | diff list |
2000/0310/boot/settime.c (diff list | history)
| 2000/0310/sys/src/9/boot/settime.c:3,8 – 2001/0527/sys/src/9/boot/settime.c:3,11 (short | long | prev | next) | ||
| 1993/0330 | #include <auth.h> | |
| 1992/0318 | #include <fcall.h> #include "../boot/boot.h" | |
| 2001/0527 | /*BUG transition*/ int client9p=2; int kernel9p=2; | |
| 1992/0318 | ||
| 1992/0611 | static long lusertime(char*); | |
| 2000/0310/sys/src/9/boot/settime.c:13,20 – 2001/0527/sys/src/9/boot/settime.c:16,23 | ||
| 1992/0318 | { int n, f; int timeset; | |
| 2001/0527 | Dir dir[2]; char timebuf[64]; | |
| 1992/0318 | print("time..."); timeset = 0; | |
| 2000/0310/sys/src/9/boot/settime.c:24,38 – 2001/0527/sys/src/9/boot/settime.c:27,41 | ||
| 1992/0318 | */ f = open("#r/rtc", ORDWR); if(f >= 0){ | |
| 2001/0527 | if((n = read(f, timebuf, sizeof(timebuf)-1)) > 0){ timebuf[n] = '\0'; | |
| 1992/0318 | timeset = 1; } close(f); | |
| 1992/0611 | }else do{ | |
| 2001/0527 | strcpy(timebuf, "yymmddhhmm[ss]"); outin("\ndate/time ", timebuf, sizeof(timebuf)); }while((timeset=lusertime(timebuf)) <= 0); | |
| 1992/0318 | } if(timeset == 0){ /* | |
| 2000/0310/sys/src/9/boot/settime.c:47,61 – 2001/0527/sys/src/9/boot/settime.c:50,64 | ||
| 1993/0330 | return; } | |
| 1992/0318 | close(f); | |
| 2000/0310 |
| |
| 2001/0527 | if(stat("/mnt", statbuf, sizeof statbuf) < 0) | |
| 1992/0318 | fatal("stat"); | |
| 2001/0527 | convM2D(statbuf, sizeof statbuf, &dir[0], (char*)&dir[1]); sprint(timebuf, "%ld", dir[0].atime); | |
| 2000/0310 | unmount(0, "/mnt"); | |
| 1992/0318 | } f = open("#c/time", OWRITE); | |
| 1992/0611 |
| |
| 2001/0527 | if(write(f, timebuf, strlen(timebuf)) < 0) | |
| 1992/0611 | warning("can't set #c/time"); | |
| 1992/0318 | close(f); | |
| 1993/0501 | print("\n"); | |