On Sun, Dec 13, 2009 at 11:01 PM, Peter Jeremy <peterjer...@acm.org> wrote: > On 2009-Dec-13 16:27:41 +0000, "Dr. David Kirkby" <david.kir...@onetel.net> > wrote: >>If you have a system with the GNU version of date, then >> >>date -u +%s >> >>will give the seconds since the Epoch. Unfortunately, it only works with GNU >>date, and so will not work on Solaris, HP-UX or no doubt many other Unix >>systems. > > FWIW, '%s' _does_ work with FreeBSD.
It works with OS X also. >>For every system I am able to check this on, the following script >>gives exactly the same output as the GNU date command, but in a more >>portable manner. > > It works on FreeBSD/amd64 and FreeBSD/i386. It probably needs some > more rigorous checking than "it works today". Where did you find this > particular algorithm - it's somewhat simpler than the one I use. > >># $5 = seconds (0-59) > > Whilst we're being pedantic, this should be (0..60) to allow for leap > seconds. > > On 2009-Dec-13 17:05:25 +0000, "Dr. David Kirkby" <david.kir...@onetel.net> > wrote: > >>The code takes leap years into account, and is said to work until >>2100, in which case, we will all be dead. (or 2034 unless unix time >>is changed to a 64-bit number). > > A few comments: > - The 32-bit Unix epoch rolls over in 2038. > - This also depends on the type expr(1) uses for integer math. > - I wouldn't bet on everyone currently working on Sage being dead in 2100: > If you're in your early 20's now, you'll be less that 115 then - which > is not impossible today and will only become more common in future > (assuming advances in medical science continue and aren't offset by a > worsening environment). Check out the latest addition here http://sagemath.org/library-stories.html in the upper right. It is from someone who is very interested in contributing to Sage... and he is 12 years old! William -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org