| plan 9 kernel history: overview | file list | diff list |
1992/0325/boot/settime.c (diff list | history)
| boot/settime.c on 1992/0318 | ||
| 1992/0318 | #include <u.h> #include <libc.h> #include <fcall.h> #include "../boot/boot.h" void settime(int islocal) { int n, f; int timeset; Dir dir; char dirbuf[DIRLEN]; char *srvname; print("time..."); timeset = 0; if(islocal){ /* * set the time from the real time clock */ f = open("#r/rtc", ORDWR); if(f >= 0){ if((n = read(f, dirbuf, sizeof(dirbuf)-1)) > 0){ dirbuf[n] = 0; timeset = 1; } close(f); } } if(timeset == 0){ /* * set the time from the access time of the root */ f = open("#s/boot", ORDWR); if(f < 0) return; | |
| 1992/0325 | if(mount(f, "/n/boot", MREPL, "", sauth) < 0){ | |
| 1992/0318 | close(f); return; } close(f); if(stat("/n/boot", dirbuf) < 0) fatal("stat"); convM2D(dirbuf, &dir); sprint(dirbuf, "%ld", dir.atime); unmount(0, "/n/boot"); /* * set real time clock if there is one */ f = open("#r/rtc", ORDWR); if(f > 0){ write(f, dirbuf, strlen(dirbuf)); close(f); } close(f); } f = open("#c/time", OWRITE); write(f, dirbuf, strlen(dirbuf)); close(f); } | |