[vox-tech] Easiest way to calculate date in 100 ns increments?
Peter Jay Salzman
p at dirac.org
Wed Jun 23 14:32:28 PDT 2004
On Wed 23 Jun 04, 2:08 PM, Bill Kendrick <nbs at sonic.net> said:
> On Wed, Jun 23, 2004 at 01:54:26PM -0700, emily wrote:
> >
> > I need to be able to convert dates from a human readable format
> > (something like YYYYMMDD) to a number in hundred nanosecond intervals
> > starting from Jan 1 1601 as 0.
>
> In C there's the ctime function and friends. Kind of a pain to use.
i don't think ctime() will get her where she wants to go easily.
> I'm betting PHP or Perl has something handy just for this.
> (I know "time()" in PHP gives the current time in seconds since Unix epoch,
> which was 1970, perhaps it's flexible about epoch and/or using an arbitrary
> date/time)
sounds like a job for perl. if perl can't do it, i'll eat my shorts.
a quick google search yields perl-Date-Calc:
This package consists of a C library (usable standalone), and a Perl
module to access this library from Perl.
The library provides all sorts of date calculations based on the
Gregorian calendar (the one used in all western countries today),
thereby complying with all relevant norms and standards: ISO/R
2015-1971, DIN 1355 and, to some extent, ISO 8601 (where applicable).
i've never used this package, but it at least sounds hopeful.
google also reports Date::Pcalc, which claims to be very similar to
perl-Date-Calc, but written completely in perl (he claims that he
wrote perl-Date-Calc because an ISP prevented him from compiling C code
on a server, so he couldn't use perl-Date-Calc.
looks like there are a few perl date calculation packages.
i'm sure python also has ways of doing this (but i don't know a lick of
python).
hth,
pete
--
In theory, theory and practise are the same. In practise, they aren't.
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
More information about the vox-tech
mailing list