]> gitweb.factorcode.org Git - factor.git/commitdiff
calendar.format: adding ctime format.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 10 Dec 2020 19:16:40 +0000 (11:16 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 10 Dec 2020 19:16:40 +0000 (11:16 -0800)
basis/calendar/format/format.factor

index b80d99a636203b8f1f90e960c0901deb707100fe..6c602008c4c20ada349b2e5d3ec093f9760a474f 100644 (file)
@@ -154,6 +154,14 @@ ALIAS: timestamp>rfc822 timestamp>rfc2822
 : timestamp>iso8601 ( timestamp -- str )
     [ write-iso8601 ] with-string-writer ;
 
+: write-ctime ( timestamp -- )
+    {
+        DAY " " MONTH " " DD " " hh ":" mm ":" ss " " YYYY
+    } formatted ;
+
+: timestamp>ctime-string ( timestamp -- str )
+    [ write-ctime ] with-string-writer ;
+
 : timestamp>git-string ( timestamp -- str )
     [
         {