> Hello everyone....forgive a newbie question....Perl has a time function
> which returns a number of seconds since a certain date. With
> Rebol I can get
> now/time, now/date, etc. Is there an easy way to get the same
> type of value
> that the Perl time() function returns? I seem to have problems
> multiplying
> what returns from now with integer or decimal data types, like in
> a payroll
> calculation where hours_worked * pay_rate = paycheck. Thanks in
> advance for
> your help.
>
> Rebol rules!
>
There was a lengthy discussion on this epoch date recently (which I
instigated because I needed this very function in a program I was then
writing and am now successfully using). A number of people contributed
excellent ideas.
Here is the resulting code that gives an accurate answer. Enjoy!
--Ralph
---------------------------------------
date: now
seconds: ((date - 1-1-1970) * 86400) + (date/time/hour * 3600) +
(date/time/minute * 60) + date/time/second
zone: now/zone ; compensate for your time zone, Rebol knows it for
you
zone: zone/hour
zone: zone * 3600
seconds: seconds - zone ; minus a minus gives plus
print seconds ; seconds since the Epoch (1-1-1970)