X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fdatetime.lua;h=cf00e4c320323a03d137742bb2dd0fd5143df2a2;hb=80e7ab5087258ceb6f9bf9fb195b077fb63d7031;hp=3c42e499a2e6d844120ae9b0a1f96d4a713759ad;hpb=8a6a7668b61b7c7a9a533f407e2610e90aa8a1a5;p=prosody.git diff --git a/util/datetime.lua b/util/datetime.lua index 3c42e499..cf00e4c3 100644 --- a/util/datetime.lua +++ b/util/datetime.lua @@ -1,37 +1,37 @@ --- Prosody IM v0.3 --- Copyright (C) 2008 Matthew Wild --- Copyright (C) 2008 Waqas Hussain +-- Prosody IM +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 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;