X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fdatetime.lua;h=c582a424f8bfafec6e05e6b9b5452034f2d71720;hb=2949c6844187c10f634e60bf00166c899f90044a;hp=3f0ce12ca60af9f2d410bdf403485f1d60f69127;hpb=489e8504301004d44240e4b9cb7194340d869a0a;p=prosody.git diff --git a/util/datetime.lua b/util/datetime.lua index 3f0ce12c..c582a424 100644 --- a/util/datetime.lua +++ b/util/datetime.lua @@ -1,37 +1,37 @@ --- Prosody IM v0.2 --- Copyright (C) 2008 Matthew Wild --- Copyright (C) 2008 Waqas Hussain +-- Prosody IM +-- Copyright (C) 2008-2009 Matthew Wild +-- Copyright (C) 2008-2009 Waqas Hussain -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- --- XEP-0082: XMPP Date and Time Profiles - -local os_date = os.date; -local error = error; - -module "datetime" - -function date() - return os_date("!%Y-%m-%d"); -end - -function datetime() - return os_date("!%Y-%m-%dT%H:%M:%SZ"); -end - -function time() - return os_date("!%H:%M:%S"); -end - -function legacy() - return os_date("!%Y%m%dT%H:%M:%S"); -end - -function parse(s) - error("datetime.parse: Not implemented"); -- TODO -end - -return _M; +-- XEP-0082: XMPP Date and Time Profiles + +local os_date = os.date; +local error = error; + +module "datetime" + +function date(t) + return os_date("!%Y-%m-%d", t); +end + +function datetime(t) + return os_date("!%Y-%m-%dT%H:%M:%SZ", t); +end + +function time(t) + return os_date("!%H:%M:%S", t); +end + +function legacy(t) + return os_date("!%Y%m%dT%H:%M:%S", t); +end + +function parse(s) + error("datetime.parse: Not implemented"); -- TODO +end + +return _M;