Skip to content
This repository was archived by the owner on Mar 20, 2018. It is now read-only.
This repository was archived by the owner on Mar 20, 2018. It is now read-only.

POSIX-compatibility with java.util.Date #343

@MenoData

Description

@MenoData

The java.time.Instant - java.util.Date - conversion is defined in latter class via a simple algorithm to translate between Instant-seconds/nanos and millis on the other side. Basis is obviously a constant factor of 86400 secs per day. That is also the commonly expected behaviour of java.util.Date to just be a millisecond version of a unix timestamp.

What is disturbing here, is the javadoc/spec of java.time.Instant. There and on some other locations you introduce a so-called "java time scale", which shall be UTC-SLS, explicitly stated for class Instant. Leaving the fact aside that you try to revive an expired proposal, we surely agree that nobody in java world up to now has assumed or treated java.util.Date to be an implementation of UTC-SLS, but rather POSIX. The conversion between these time scales should either be reflected by conversion algorithm between Instant and j.u.Date (requiring a missing leap second table in the background) - or: The spec should be changed to replace this "java time scale" just by POSIX (which is probably the most honest, straight-forward and simpliest solution). Otherwise you will have behavioural incompatibility of j.u.Date with the spec (for ever?). We have enough confusion by pointless talk about non-supported leap seconds for example in the javadoc of j.u.Date. Just say: "We don't support leap seconds." Done.

Also important: By far the most used clock will be based on System.currentTimeMillis(). This clock while not very precise does never count any leap seconds and can just be seen as a kind of POSIX clock regarding the fact that all underlying UNIX operating systems use POSIX and that the JVM is heavily inspired by that (for example choosing the same epoch of 1970-01-01T00:00:00Z). So here again there is no space left for UTC-SLS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions