Roxen.git/
server/
etc/
modules/
Roxen.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2003-10-06
2003-10-06 12:07:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>
c6a8a589d8e46af80562f6201c3e6712546062c3 (
16
lines) (+
11
/-
5
)
[
Show
|
Annotate
]
Branch:
5.2
Fixed bug in iso8601_date_time().
Rev: server/etc/modules/Roxen.pmod:1.162
1:
// This is a roxen pike module. Copyright © 1999 - 2001, Roxen IS. //
-
// $Id: Roxen.pmod,v 1.
161
2003/
07
/
15
08
:
50
:
46
anders
Exp $
+
// $Id: Roxen.pmod,v 1.
162
2003/
10
/
06
12
:
07
:
34
grubba
Exp $
#include <roxen.h> #include <config.h>
470:
//! Returns a timestamp formatted according to ISO 8601 Date and Time //! RFC 2518 23.2. No fraction, UTC only.
-
string iso8601_date_time(int ts)
+
string iso8601_date_time(int ts
, int|void ns
)
{ mapping(string:int) gmt = gmtime(ts);
-
+
if (zero_type(ns)) {
return sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",
-
1900 + gmt->year, gmt->
mon
, gmt->mday,
+
1900 + gmt->year, gmt->
mon+1
, gmt->mday,
gmt->hour, gmt->min, gmt->sec); }
-
+
return sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%09dZ",
+
1900 + gmt->year, gmt->mon+1, gmt->mday,
+
gmt->hour, gmt->min, gmt->sec, ts);
+
}
string http_encode_string(string f) //! Encode dangerous characters in a string so that it can be used as