Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] unixtime

From: peoyli::algonet::se at: 16-Aug-2000 7:13

This is a MIME encoded multipart message. The fact that you are reading this means you don't have a MIME capable mail program. You might still be able to read part of the mail's content, but some of it may require a MIME capable mail reader to decode. Following are some URLs where you can find MIME-capable mail programs for common platforms: Amiga............: MicroDot-II http://www.vapor.com/ Unix.............: Metamail ftp://ftp.bellcore.com/nsb/ Windows/Macintosh: Eudora http://www.qualcomm.com/ General info about MIME can be found at: http://www.cis.ohio-state.edu/hypertext/faq/usenet/mail/mime-faq/top.html --=_=8<==MD2399AB406-56A6E9EA==8<=_Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I have written some routines unix time to human readable time and the other way around.. but.. ah.. the routines seems to work now (I can't remember what I changed).. The problem was that
>> print unixtime-to-time time-to-unixtime now print now
16-Aug-2000/15:29:11+1:00 16-Aug-2000/15:29:12+1:00 returned alot different times (about 2 minutes in difference).. /PeO -- /* P-O Yliniemi, Bizlink Systems & Development AB *\ \* [peo--bizlink--se] | Solaris (SunOS 5.6-5.8), Perl, REBOL | [peoyli--algonet--se] */ /* +46-70-4663336 | CGI, (S)HTML, PHP, sql | +46-70-5685919 *\ \* | Apache, qmail, squid, BIND, IPFilter | +46-911-205474 */ --=_=8<==MD2399AB406-56A6E9EA==8<=_Content-Type: text/plain; charset=us-ascii; name="subs.r" Content-Transfer-Encoding: plain (7/8 bit) Content-Disposition: attachment; filename="subs.r" X-MD2-FilePath: Beta:REBOL/RebIRC/subs.r REBOL [] unixtime-to-time: func [ {Convert from unix time to human readable date/time} unixtime [integer!] "Seconds since 1-Jan-1970 0:00" /local days resttime ] [ days: unixtime / 3600 / 24 resttime: to-time rejoin ["0:0:" to-integer (days - to-integer days) * 3600 * 24] return to-date rejoin [ (01-Jan-1970 + to-integer days) "/" (resttime + now/zone) either negative? now/zone [ rejoin ["-" now/zone]] [ rejoin ["+" now/zone]] ] ] time-to-unixtime: func [ {Convert from human readable date/time to unix time} date [date!] "Date/time to convert" /local daysec ] [ date: date daysec: (date - 1-Jan-1970) * 3600 * 24 if date/time [date: date - date/zone daysec: daysec + (date/time/hour * 3600) + (date/time/minute * 60) + (to-integer date/time/second)] return daysec ] --=_=8<==MD2399AB406-56A6E9EA==8<=_=-- (end of MIME multipart message)