Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ANN: Julian dates

9 views
Skip to first unread message

sp...@controlq.com

unread,
Nov 7, 2006, 5:12:31 PM11/7/06
to

As I have announced this to the SQLite users mail list, I thought I might
mention it here as well.

In keeping with the spirit of D.R. Hipp's "blessing", and specifically for
those who use Tcl/SQLite, but hopefully not limited to those, I've
released an old (ie: well used) relatively portable C library of Julian
date routines, and a Tcl binding for it under an open source license. Man
pages are provided for the Tcl bindings, and but the C source will have to
suffice for the C library documentation.

The makefile cross builds the .dll using MingW32 (though I have not tested
that .dll in quite some time), and builds both the Julian.DLL and
Julian.so files for both Windows and most Unix like variants. It will
require a reasonably recent version of gnu make, and some twiddling to get
working right on your platform, unless you use FreeBSD, and then it
should just work.

http://www.controlq.com/OpenSource/Tcl_Julian.tgz

Please note, for those who have made extensions available under the TEA
system, and sophisticated build and packaging scripts, this is not as
polished, but does include a gnu make file, and MinGW32 sample
X-compilation from FreeBSD. I simply haven't the time. Hopefully the
compilation is simple enough, and the makefile clear enough that it won't
need a whole lot of support.

Enjoy,
Rob

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Kevin Kenny

unread,
Nov 7, 2006, 6:56:23 PM11/7/06
to
sp...@controlq.com wrote:
>
> In keeping with the spirit of D.R. Hipp's "blessing", and specifically for
> those who use Tcl/SQLite, but hopefully not limited to those, I've
> released an old (ie: well used) relatively portable C library of Julian
> date routines, and a Tcl binding for it under an open source license.

It's also worth noting that the [clock] command in 8.5 can do
[clock scan $julianDay -format %J] and [clock format $time -format %J]
to convert times-since-epoch to and from Julian Day Numbers. Of course,
once you have time-since-epoch, [clock] can make it into practically
anything else.

--
73 de ke9tv/2, Kevin

sp...@controlq.com

unread,
Nov 7, 2006, 7:59:36 PM11/7/06
to
On Tue, 7 Nov 2006, Kevin Kenny wrote:

> Date: Tue, 07 Nov 2006 18:56:23 -0500
> From: Kevin Kenny <ken...@acm.org>
> Newsgroups: comp.lang.tcl
> Subject: Re: ANN: Julian dates

Kevin,

Rightly so, the new 8.5 clock features are significantly improved but
these routines have been in use for over 15 years, long before the 8.5 Tcl
feature set was established.

The Epoch in Unix is Jan 1 1970, and in winDoze about Jan. 1600 (at least
for file system dates), but the true Epoch, was established in 1583 (Oct
15th) by Papal decree. My routines use the earlier epoch, not that it
matters much as to which one you use, but only that you stick to the one
you start with. In addition, the J_Date units are measured in days, and
the J_Time units are measured in seconds. They can be converted back and
forth to timestamp [clock seconds] type date times, but make for simple
date/time arithmetic, and separate dates (days) from times (secs).

Also, this does not constitute a TIP, or proposal to change Tcl in any way
shape or form but simply offers an extension for those who might use/need
it.

Cheers,
Rob.

Kevin Kenny

unread,
Nov 8, 2006, 8:35:15 PM11/8/06
to
> The Epoch in Unix is Jan 1 1970, and in winDoze about Jan. 1600 (at least
> for file system dates), but the true Epoch, was established in 1583 (Oct
> 15th) by Papal decree. My routines use the earlier epoch, not that it
> matters much as to which one you use, but only that you stick to the one
> you start with. In addition, the J_Date units are measured in days, and
> the J_Time units are measured in seconds. They can be converted back and
> forth to timestamp [clock seconds] type date times, but make for simple
> date/time arithmetic, and separate dates (days) from times (secs).

Indeed, the Windows and Posix epochs are different. Tcl follows the
Posix epoch on all platforms.

Tcl's Julian Day Number is that of the astronomers (and bankers). Its
epoch has nothing to do with the Gregorian reform, other than the fact
that Joseph Scaliger proposed it in 1582 to ease calculations across
the forthcoming Gregorian transition. Its epoch is 1 January of the
year 4713 B.C.E. of the proleptic Julian calendar. (Technically,
the date should advance at noon mean solar time on the meridian of
Alexandria; Tcl finds it more convenient to advance the day number
at midnight local time.)

Tcl doesn't bother with a "Julian time" field. In practice, seconds
from the Posix epoch work well for practically everything, particularly
since 8.5 does not have arbitrary restrictions on how far into the
past or future it can reach. In fact, for European locales, it even
handles the correct locale-dependent Gregorian calendar transition.
(It does not attempt to put the New Year on 25 March - that was a
bridge too far.)

More on this at http://en.wikipedia.org/wiki/Julian_day

0 new messages