Hello all,
We have recently had a problem with our applications due to users
changing the Timezone on their computers.
While investigating the issue, I had a look at how H2 actually stores
a Timestamp internally and found out the following:
It saves the time in local format by adding the time zone offest
See org.h2.util.DateTimeUtils.getTimeLocal()
and when it restores the time it changes it back to GMT by subtracting
the zone offset.
See org.h2.util.DateTimeUtils.getTimeGMT().
So here are my questions/remarks:
1) The code works perfectly fine as long as the users do NOT change
their Timezone
between server restarts. If someone shuts down our server
app(including the embedded H2),
then change the system Timezone then if I am not mistaken that
will produce the wrong result
when loading back the saved time value as the zone offset might be
different.
2) Since the actual time in Date objects is always represented in
GMT,
why is that conversion needed anyway? Would it not suffice to
simply store the GMT milliseconds directly?
Is there something that I am missing (e.g. some spec requirement)?
Please let me know what you think and if there is a possibility of a
fix or workaround
in case my assumptions are right.
Thanks for your time.
Best regards,
Panayiotis Vlissidis
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.