This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Solution?: Saving Dates in Cygwin/Windows with hibernating PCs

I read with interest the problems with getting good time stamps from modern
PC Systems that hibernate.

I've been working on a different problem, and it occurs to me that a
utility of Windows can be used to solve this problem, if you don't mind
doing it in a non-GNUish way.

There's a console program called 'setx' that comes with Windows XP/Vista,
that allows you to make a "permanent" change to the Windows System or User
environment variables, as if you had used:
 Control Panel / System / Advanced System Settings / Advanced /
 Environment Variables / System Variables | User Variables / <select
 variable_of_interest_if_exists> / New | Edit / <enter_changes> / OK

If you use 'setx' to record the boot time in a system startup script as a
system environment variable, say, MYBOOTTIME, then you can use this later
on, without impact of hibernate.

'setx' could be run from a 'cmd.exe' batch file placed in the 'Startup'
folder, or a shell script could be invoked from that batch file that does
everything that you want.

If you're a stickler for the exact boot time, you could have the script
look-up the system boot time, using the previously mentioned perl hacks,
and then use 'setx' to store that, before hibernation could mess it up. It
would appear that you could even use the difference in times between a new
boot time lookup and the environment variable timestamp to determine how
much hibernation time had occurred.

Variations of this tack could be used to compute other times.

Does this help, or am I just wasting time? ;-)


-- Unsubscribe info: Problem reports: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]