X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/c21d0650957336fab335228413fa3a53ee4cc338..88cbee758e827b9b3a1c9a6be61f1fc3d65b6575:/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 )