our(@ISA, %EXPORT_TAGS, @EXPORT_OK, @EXPORT, $AUTOLOAD, %SIGRT) = ();
-our $VERSION = "1.17";
+our $VERSION = "1.18";
use AutoLoader;
# ST(0) = sv_2mortal(newSVpv(...))
void
strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
- char * fmt
+ SV * fmt
int sec
int min
int hour
int isdst
CODE:
{
- char *buf = my_strftime(fmt, sec, min, hour, mday, mon, year, wday, yday, isdst);
+ char *buf = my_strftime(SvPVutf8_nolen(fmt), sec, min, hour, mday, mon, year, wday, yday, isdst);
if (buf) {
- ST(0) = sv_2mortal(newSVpv(buf, 0));
+ ST(0) = sv_2mortal(newSVpvn_utf8(buf, strlen(buf), SvUTF8(fmt)));
Safefree(buf);
}
}
use Config;
use POSIX;
-use Test::More tests => 9;
+use Test::More tests => 10;
# go to UTC to avoid DST issues around the world when testing. SUS3 says that
# null should get you UTC, but some environments want the explicit names.
my $jan_16 = 15 * 86400;
is(ctime($jan_16), strftime("%a %b %d %H:%M:%S %Y\n", localtime($jan_16)),
"get ctime() equal to strftime()");
+is(strftime("%Y年%m月%d日", localtime($jan_16)), "1970年01月16日",
+ "strftime() can handle unicode chars in the format string");
setlocale(LC_TIME, $orig_loc) || die "Cannot setlocale() back to orig: $!";
# clock() seems to have different definitions of what it does between POSIX