dan@ivucsb.UUCP (Dan Howell) (12/08/88)
Is there some way to make the clock survive a reset on the Amiga 1000? Maybe using the RAD: device somehow? Or should I just fork over the money for a battery backed up clock? -- Dan Howell <...!pyramid!comdesign!ivucsb!dan> <dan@ivucsb.UUCP> -- The Heineken Uncertainty Principle: -- You can never be sure how many beers you had last night.
gmg@hcx.uucp (Greg M. Garner) (12/20/88)
In article <441@ivucsb.UUCP>, dan@ivucsb.UUCP (Dan Howell) writes: > Is there some way to make the clock survive a reset on the Amiga 1000? > Maybe using the RAD: device somehow? Or should I just fork over the > money for a battery backed up clock? > > > -- Dan Howell <...!pyramid!comdesign!ivucsb!dan> <dan@ivucsb.UUCP> Here is a little hack that might do the trick. First is a little modification to you startup sequence. if not exist rad:time.dat date ? time2 >rad:time.dat endif execute rad:time.dat --------------------------- This will prompt you for the correct time and date when you first startup, and then the small C program time2 will put a small file in rad: called time.dat, which contains the line : date 19-Dec-88 22:04:00 Then when you execute this file on startup, it sets the time to the last time you wrote into the file. Now, of course, you must run the program time2 every now and then, and I thought that you could use amicron to do this. It will run a program at regular intervals. I don't know how much cpu time it takes to do this, but I'll leave that up to you. Amicron can be found on FISH disk 139. Here is the small C program that writes the date into the file in the correct format (Hope you have acces to a C compiler, if not email me and I will try to mail you the binary). ---------------------- #include "time.h" /* This is the standard time header (it exists in manx)*/ #include "stdio.h" /* Make sure that NULL is defined. */ main() { struct tm *ptr; /* Create a pointer to the time structure. */ time_t lt; /* This is a long with the time packed into it. */ char *str; /* Point to the time string. */ char buffer[80]; /* Make a work buffer. */ lt = time(NULL); /* Get the system time into lt (long). */ ptr = localtime(<); /* Unpack the long into the time structure. */ str = asctime(ptr); /* Get a pointer to the string. */ strncpy(buffer,str+8,3); /* Get the day of the month first. */ buffer[2] = '-'; strncpy(buffer+3,str+4,3); /* Get the month. */ buffer[6] = '-'; strncpy(buffer+7,str+22,2); /* Get the year. */ buffer[9] = ' '; strncpy(buffer+10,str+11,8); /* Get the time. */ buffer[18] = '\0'; /* Make sure string is NULL terminated. */ printf("date %s\n",buffer); } -------------- Bye the way, if anyone at Commodore is listening, it would be nice if the date command would accept have an option to take the date from a file, instead of just writing to a file. Maybe in 1.4? (or maybe there is another way to do it that I don't know about.) Good luck! Greg Garner 501-442-4847 USENET: ...!uunet!harris.cis.ksu.edu!hcx!gmg
nmm@apss.ab.ca (Neil McCulloch) (12/21/88)
> In article <441@ivucsb.UUCP>, dan@ivucsb.UUCP (Dan Howell) writes: > > Is there some way to make the clock survive a reset on the Amiga 1000? > > Maybe using the RAD: device somehow? Or should I just fork over the > > money for a battery backed up clock? > > Is there anyway of doing a soft reset from a command file? This would let you execute the equivalent of a .logout file which would naturally contain a file write to save the current time. This would be preferable for me on my 512 1000 where I have to hoard my memory :(. neil
kodiak@amiga.UUCP (Robert R. Burns) (12/22/88)
In article <1462@cseg.uucp> gmg@hcx.uucp (Greg M. Garner) writes: )Bye the way, if anyone at Commodore is listening, it would be nice if the )date command would accept have an option to take the date from a file, )instead of just writing to a file. Maybe in 1.4? (or maybe there is )another way to do it that I don't know about.) 1> echo >ram:qwe "2:00 01-dec-88" i.e. put the date in a file in the form required for input 1> date <ram:qwe >nil: ? this reads the file to set the date -- Bob Burns, amiga!kodiak _ | /_ _|. _ | Commodore __ |_) _ |_ _ )' |<(_)(_)|(_\|< /\ | ||| _` /\ |_)(_\| )(_\ | | \ Software ___/..\|\/|||__|/..\___ Faith