From 914456f31578965c0f07fcaa6c065e5f48bc6230 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 5 Mar 2008 16:07:25 -0600 Subject: [PATCH] year month day > timestamp year month day hour minute second > timestamp --- extra/calendar/format/format.factor | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/extra/calendar/format/format.factor b/extra/calendar/format/format.factor index 75ceea8ea2..d89afe615e 100755 --- a/extra/calendar/format/format.factor +++ b/extra/calendar/format/format.factor @@ -125,6 +125,35 @@ M: timestamp year. ( timestamp -- ) : rfc3339>timestamp ( str -- timestamp ) [ (rfc3339>timestamp) ] with-string-reader ; +: (ymdhms>timestamp) ( -- timestamp ) + read-0000 ! year + "-" expect + read-00 ! month + "-" expect + read-00 ! day + " " expect + read-00 ! hour + ":" expect + read-00 ! minute + ":" expect + read-00 ! second + 0 ! timezone + ; + +: ymdhms>timestamp ( str -- timestamp ) + [ (ymdhms>timestamp) ] with-string-reader ; + +: (ymd>timestamp) ( -- timestamp ) + read-0000 ! year + "-" expect + read-00 ! month + "-" expect + read-00 ! day + 0 0 0 0 ; + +: ymd>timestamp ( str -- timestamp ) + [ (ymd>timestamp) ] with-string-reader ; + : file-time-string ( timestamp -- string ) [ [ month>> month-abbreviations nth write ] keep bl