X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/e0dbd486c7005f901811529ef5b82f5bd95211ea..e3d5c044607a407cc2ec0975f233879c71c50f94:/src/timetable.lua diff --git a/src/timetable.lua b/src/timetable.lua index 9b78576..c71c59b 100644 --- a/src/timetable.lua +++ b/src/timetable.lua @@ -134,8 +134,14 @@ 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 ;