FYI.....

A billion seconds...wow....

DJ

-------- Original Message --------
Subject: A billion, anyone?
Date: Thu, 27 Apr 2006 08:57:10 +0100
From: Mike Cowlishaw <[EMAIL PROTECTED]>
Reply-To: Rexx Language Association <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

I'm celebrating a billion seconds as an employee of IBM today, so I
thought I'd share a couple of Rexx snippets: one for calculating the date
and time a billion seconds ago, and another for calculating a billion
seconds from the start of a given day.

These require 'modern' date() and time() functions.

mfc

- - - - -

/* billion-ago -- display the date and time a billion seconds ago. */
/* (Excluding leap-seconds.)                                   mfc */

numeric digits 16
secsperday=24*60*60

parse value date('b') time('s') with days secs
total=days*secsperday+secs

then=total-1E+9
thendays=then%secsperday
thensecs=then//secsperday

date=date('n', thendays, 'b')
time=time('n', thensecs, 's')

say 'A billion seconds ago was:' date time

- - - - -

/* billion-from -- calculate a billion seconds from a date.        */
/* (Excluding leap-seconds.)                                   mfc */

say 'Enter start date (yyyymmdd):'
pull start

base=date('b', start, 's')
plus=base+11574
new=date('n', plus, 'b')

say 'A billion seconds from' start 'is:' new '(+ 1:46:40)'

Reply via email to