Ian Malone <ib***@cam.ac.ukwrites:
[snip]
As an alternative either:
1. Use whatever routine this platform has for converting SYSTEMTIME
to a single number (in seconds, milliseconds or whatever) and
subtract the right amount, then convert back.
2. Use the C function time to get the time in seconds, subtract
15*60, use localtime to convert the result to struct_tm.
The latter assumes that time_t represents the time in seconds. It
commonly does, but there is no such guarantee (or implication) in the
C standard.
If you need portability, you can convert a time_t value to a struct tm
using localtime(), manipulate the members of the struct tm, then
convert it back using mktime().
If you don't care about absolute portability (e.g., if your platform
happens to make guarantees about the representation of time_t, and
your code is already platform-specific anyway), you can probably get
away with performing arithmetic directly on a time_t. Or you can
consult your system's documentation for solutions.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.