Java – why not run server-side applications with daylight saving time enabled?

I have implemented a server - side application that records the timestamp when the record is created and updated The application assumes that the server clock does not have daylight saving time enabled, (a) because I have read that this is a best practice, and (b) because I think it would be difficult (if not impossible) to deal with ambiguities, such as when the clock returned for an hour in October

For security reasons, if the application detects that DST is enabled at startup, an error is logged and the application is terminated Even if DST is enabled on the application server clock, I will be requested by internal stakeholders to make the application work normally

I think it's foolish to try this, but I need to convince the management Is it just because it makes the implementation more difficult, or is there a fundamental defect that such an application (recording timestamp) cannot run 100% correctly at any time of the year? What is the best reason to run such an application without enabling DST?

The best thing I can think of is:

It's true? Can you actually determine (in a Java Web application) whether the event that occurred at 1:30 a.m. on October 25 was before or after the clock adjustment?

Any better reason to avoid daylight saving time?

to update

It should be clear that the application must store the time as UTC The question is why enabling DST on the server computer is a bad idea when trying to do this

Solution

There is no reason to disable DST on the server because the time zone (or I should say "should") is just formatted The system clock is independent of the time zone Timestamps should be stored in an explicit format or as "epoch from epoch", such as system Currenttimemillis() and its equivalent (time zone independent), or as text specifying the UTC offset (and then become explicit, such as ISO 8601)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>