X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/c21d0650957336fab335228413fa3a53ee4cc338..d535197d4d94122f86a485aac740bc7329664129:/src/timetable.lua diff --git a/src/timetable.lua b/src/timetable.lua index 5fa7205..c71c59b 100644 --- a/src/timetable.lua +++ b/src/timetable.lua @@ -134,8 +134,17 @@ function timetable_methods:timestamp ( ) return timestamp ( unpack_tm ( self ) ) end +function timetable_methods:rfc_3339 ( ) + -- %06.4g gives 3 (=6-4+1) digits after decimal + return strformat ( "%04u-%02u-%02uT%02u:%02u:%06.4g" , unpack_tm ( self ) ) +end + local timetable_mt = { __index = timetable_methods ; + __tostring = timetable_methods.rfc_3339 ; + __eq = function ( a , b ) + return a:timestamp() < b:timestamp() + end ; } local function cast_timetable ( tm )