diff --git a/basis/calendar/format/format-tests.factor b/basis/calendar/format/format-tests.factor index 8b9885a63c..b1598df2fe 100644 --- a/basis/calendar/format/format-tests.factor +++ b/basis/calendar/format/format-tests.factor @@ -95,7 +95,7 @@ IN: calendar.format.tests } ] [ "2013-04-23T13:50:24" rfc3339>timestamp ] unit-test -{ "2001-12-14T21:59:43.1-05:00" } [ "2001-12-14T21:59:43.1-05:00" rfc3339>timestamp timestamp>rfc3339 ] unit-test +{ "2001-12-14T21:59:43.100000-05:00" } [ "2001-12-14T21:59:43.1-05:00" rfc3339>timestamp timestamp>rfc3339 ] unit-test [ T{ timestamp diff --git a/basis/calendar/format/format.factor b/basis/calendar/format/format.factor index 774d8121a6..aa02460607 100644 --- a/basis/calendar/format/format.factor +++ b/basis/calendar/format/format.factor @@ -136,16 +136,12 @@ M: timestamp year. ( timestamp -- ) ! Should be enough for anyone, allows to not do a fancy ! algorithm to detect infinite decimals (e.g 1/3) -: write-rfc3339-seconds ( timestamp -- ) - second>> 1 mod [ - >float "%.6f" format-float [ CHAR: 0 = ] trim - dup length 1 > [ write ] [ drop ] if - ] unless-zero ; +: ss.SSSSSS ( timestamp -- ) + second>> >float "%.6f" format-float 9 CHAR: 0 pad-head write ; : (timestamp>rfc3339) ( timestamp -- ) { - YYYY "-" MM "-" DD "T" hh ":" mm ":" ss - write-rfc3339-seconds + YYYY "-" MM "-" DD "T" hh ":" mm ":" ss.SSSSSS [ gmt-offset>> write-rfc3339-gmt-offset ] } formatted ;