Software /
code /
prosody
Annotate
util/datetime.lua @ 810:09d6b5fadc84
MUC: Presence and message stanzas now fully work (status messages, xhtml-im, etc)
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 16 Feb 2009 19:39:10 +0500 |
parent | 760:90ce865eebd8 |
child | 896:2c0b9e3c11c3 |
rev | line source |
---|---|
759 | 1 -- Prosody IM v0.3 |
760
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
2 -- Copyright (C) 2008-2009 Matthew Wild |
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
3 -- Copyright (C) 2008-2009 Waqas Hussain |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
248
diff
changeset
|
4 -- |
758 | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
248
diff
changeset
|
7 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
248
diff
changeset
|
8 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
248
diff
changeset
|
9 |
248
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
10 -- XEP-0082: XMPP Date and Time Profiles |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
11 |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
12 local os_date = os.date; |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
13 local error = error; |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
14 |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
15 module "datetime" |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
16 |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
17 function date() |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
18 return os_date("!%Y-%m-%d"); |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
19 end |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
20 |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
21 function datetime() |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
22 return os_date("!%Y-%m-%dT%H:%M:%SZ"); |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
23 end |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
24 |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
25 function time() |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
26 return os_date("!%H:%M:%S"); |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
27 end |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
28 |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
29 function legacy() |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
30 return os_date("!%Y%m%dT%H:%M:%S"); |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
31 end |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
32 |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
33 function parse(s) |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
34 error("datetime.parse: Not implemented"); -- TODO |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
35 end |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
36 |
8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
37 return _M; |