Re: how to make dates without timezones?



In comp.lang.java.programmer message <WeYnl.17462$yr3.9988@xxxxxxxxxxxxx
sbc.com>, Sat, 21 Feb 2009 11:04:14, Mark Space
<markspace@xxxxxxxxxxxxxx> posted:
epicwinter wrote:

I have tried this too. It works in some respects but creates new
issues. There are a few areas where time is pertinent on my
application and in this manner it would always show the client the
wrong time unless they happened to actually be in the same time zone
as the server.


This implies to me that you have two different types of dates, and you
shouldn't be trying to use the same type (java.util.Date) for both.


Indeed, there are two types of date, with an overlap. Or, rather, there
are three types of date.

One type is like the date of Easter, or Christmas, or other Birthdays :
the same date everywhere on the world (Orthodox Christians etc.
disregarded). That can be called a Chronological Date, since it is what
historians use.

The other two are the sort of date which, combined with a time of day
and an offset from UTC, indicates a single absolute instant in a
location-dependent manner; for one, the offset from UTC is the local
clock offset, for the other it is zero regardless of location.

For those whose clocks are never adjusted either for Summer & Winter or
to agree with [different] neighbours, either can be used, though it's
not reasonable to use a local date for non-local purposes.

Otherwise, one should use local dates for local events, UTC dates for
events not associated with a terrestrial locality, and Chronological
dates for ordinary life where clock changes either do not occur or can
be disregarded.

A system that handles only dates can be considered as, and implemented
by, a system that handles UTC date/time with time=00:00:00. One can
also use UTC methods to handle local date/time whenever the offset can
be disregarded - but then, ignoring Jet Stream effects, flying across
the Atlantic takes eight or ten hours longer Eastbound than Westbound.

UTC methods should be faster than local methods, because there os no
offset from UTC to be determined.


If necessary, it is easy enough to write code, using just general-
purpose programming operations, to convert between Year-Month-Day and
daycount. and to do input, output, and validation; methods, albeit not
Java, are via sig.


My anchor <URL:http://www.merlyn.demon.co.uk/estr-bcp.htm#TNS>
is immediately preceded by Easter code in JavaScript,
Pascal/Delphi, and C; I'd be pleased to add a good Java
version.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
.



Relevant Pages

  • Re: Inserting Calendar.Time in a database
    ... >> So should UTC clock. ... > appropriate time base - and we certainly don't want to insist that every ... That you can view a clock reading as ... quite often the precision required for clock synchronization of nodes ...
    (comp.lang.ada)
  • Re: Strategies for time offsets
    ... There isn't a mechanism for a negative delta time within the quadword storage, though applications are certainly free to stuff a sign bit somewhere. ... The UTC format is often a better choice here, particularly when dealing with the storage of time values. ... And then, in the core of the program, I would simply need to do a LIB$ADD_TIMES and not have to worry about whether the offset is negative or positive. ... Barring cases where this timezone stuff is the bulk of the operation and there's nothing else around consuming more cycles or wallclock time -- I/O tends to be my go-to example here for massive overhead -- I'd tend to look to optimize this math stuff and any associated system call overhead later. ...
    (comp.os.vms)
  • Re: To synchronize system time witn NTP-server with no winter time shift whole year - how to
    ... On a Linux computer, the internal clock is almost certainly *NOT* UTC, ... rather it is "seconds since Unix Epoch", ... TAI has its own Epoch back in the late '50s or early '60s. ...
    (Debian-User)
  • Re: Best Practices on setting clock?
    ... Do i need to set the CMOS clock to UTC and the actual OS or diplayed ... time would be LOCAL TIME according to my local Time Zone? ...
    (comp.unix.admin)
  • Re: TOD Clock the same as the BIOS clock in PCs?
    ... I have been told that the TOD clock similar to the RTC/CMOS clock ... do they log their times in UTC time also? ... But, do they actually display the LOCAL TIME on the VTAM, ...
    (bit.listserv.ibm-main)