What is remember?
Remember is a stopwatch and timer that can remember where it left
off if the computer crashed, rebooted, or the program closes. The
program creates a file called remember.sav which contains the time
and settings. The proram features a wave file built-into the exe file
that plays when the stopwatch has finished in stopwatch mode.
To enter stopwatch mode open this program from the command prompt with
the following parameters:
remember.exe hh:mm:ss
where hh:mm:ss is the starting time of the stopwatch. You can enter a
time up to 23:59:59
If you would like a regular timer then just open it directly.
Just remember to delete remember.sav file when you need to reset the
timer!
program remember; {$RESOURCE rem32.res} {$APPTYPE Console} uses SysUtils, windows,mmsystem, Classes; var hcon,hf:THandle; dummy:dword; save:array[0..1]of tdatetime; coor:tcoord; i:integer; s:String; label loop,timerdone,alarm; begin zeromemory(@save,sizeof(save)); hf :=createfile( 'remember.sav',GENERIC_READ or GENERIC_WRITE,0,nil,open_always, file_attribute_normal,0); save[0]:=now; if hf=INVALID_HANDLE_VALUE then begin writeln(syserrormessage(getlasterror)); exitprocess(getlasterror); end; for i:=1 to paramcount do s:=s+paramstr(i)+#32; s:=trim(s); if s<>'' then save[1]:=strtodatetime(s); readfile(hf,save,sizeof(save),dummy,nil); setfilepointer(hf,0,nil,file_begin); writefile(hf,save,sizeof(save),dummy,nil); closehandle(hf); hcon:=getstdhandle(std_output_handle); loop: coor.x:=0;coor.y:=0; setconsolecursorposition(hcon,coor); if save[1]>0 then if now-save[0]>save[1] then goto timerdone; if save[1]=0 then writeln(Trunc(now-save[0]),' days ',FormatDateTime('hh:mm:ss',now-save[0])) else if now-save[0]>save[1] then goto timerdone else write(Trunc(save[1]-(now-save[0])),' days ',FormatDateTime('hh:mm:ss',save[1]-( now-save[0])),' left '); for i:=1 to 100 do write(#32); sleep(1000); goto loop; timerdone:writeln('Timer finished at '+DateTimeToStr(now)); alarm: playsound('ALARM',hinstance,snd_resource); goto alarm; end.