eval "use POSIX";
eval "use posix" if ($@);
local @tm = localtime(time());
- return strftime($_[0], @tm);
+ &clear_time_locale();
+ local $rv = strftime($_[0], @tm);
+ &reset_time_locale();
+ return $rv;
}
else {
return $_[0];
eval "use POSIX";
eval "use posix" if ($@);
local @tm = localtime(time());
- return strftime($_[0], @tm);
+ &clear_time_locale();
+ local $rv = strftime($_[0], @tm);
+ &reset_time_locale();
+ return $rv;
}
else {
return $_[0];
eval "use POSIX";
eval "use posix" if ($@);
local @tm = localtime(time());
- return strftime($_[0], @tm);
+ &clear_time_locale();
+ local $rv = strftime($_[0], @tm);
+ &reset_time_locale();
+ return $rv;
}
else {
return $_[0];
sub get_module_variable
{
my ($v, $wantref) = @_;
+my $slash = $wantref ? "\\" : "";
if (__PACKAGE__ eq 'WebminCore') {
my ($vt, $vn) = split('', $v, 2);
my $callpkg;
for(my $i=0; ($callpkg) = caller($i); $i++) {
last if ($callpkg ne __PACKAGE__);
}
- my $slash = $wantref ? "\\" : "";
return eval "${slash}${vt}${callpkg}::${vn}";
}
-return eval "$v";
+return eval "${slash}${v}";
}
# set_module_variable(name, value)
# XXX
}
+# clear_time_locale()
+# Temporarily force the locale to C, until reset_time_locale is called
+sub clear_time_locale
+{
+if ($main::clear_time_locale_count == 0) {
+ eval {
+ $main::clear_time_locale_old = POSIX::setlocale(POSIX::LC_TIME);
+ POSIX::setlocale(POSIX::LC_TIME, "C");
+ };
+ }
+$main::clear_time_locale_count++;
+}
+
+# reset_time_locale()
+# Revert the locale to whatever it was before clear_time_locale was called
+sub reset_time_locale
+{
+if ($main::clear_time_locale_count == 1) {
+ eval {
+ POSIX::setlocale(POSIX::LC_TIME, $main::clear_time_locale_old);
+ $main::clear_time_locale_old = undef;
+ };
+ }
+$main::clear_time_locale_count--;
+}
+
$done_web_lib_funcs = 1;
1;