Roxen.git/
server/
etc/
modules/
Roxen.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2013-03-22
2013-03-22 13:27:13 by Henrik Grubbström (Grubba) <grubba@grubba.org>
0ada173d4dd16b1ee042200cf8435ddc9d9ce279 (
260
lines) (+
133
/-
127
)
[
Show
|
Annotate
]
Branch:
cdfb9463d9e78a002aa1ecadfa9e09b6e0dd41c0
strftime: Improved support for format modifiers.
1:
// This is a roxen pike module. Copyright © 1999 - 2009, Roxen IS. //
-
//
$Id: Roxen.pmod,v 1.338 2012/11/17 09:34:44 jonasw Exp $
+
//
$Id$
#include <roxen.h> #include <config.h>
2565:
mapping(string:string) m = (["type":"string"]); foreach(a[1..], string key) {
-
if(key=="") continue;
+
int(0..1) prefix = 1;
-
if
(key[0]
==
'!'
&&
sizeof(key)
>
1)
{
+
while
(
sizeof(
key
)) {
+
switch(key
[0]
)
{
+
// Flags.
+
case
'!'
:
//
Inhibit
numerical
padding (Pike
)
.
prefix = 0; key = key[1..];
-
}
-
switch(
key[
0
]
)
{
+
continue;
+
case 'E':
+
case 'O':
+
key
= key
[
1..
]
;
// No support for E or O extension.
+
continue;
+
+
// Formats.
case 'a': // Abbreviated weekday name if (language) res += number2string(lt->wday+1,m,language(lang,"short_day",id));
2616:
case 'e': // Day of month [1,31]; space-prefix res += my_sprintf(prefix, "%2d", lt->mday); break;
-
case 'E':
-
case 'O':
-
key = key[1..]; // No support for E or O extension.
-
break;
+
case 'H': // Hour (24-hour clock) [0,23]; 0-prefix res += my_sprintf(prefix, "%02d", lt->hour); break;
2697:
// no time zone information exists } res+=key[1..];
+
break;
}
-
+
}
return replace(res, "\0", "%"); }