Restore old locale properly
This commit is contained in:
parent
8234eb2519
commit
1f30a4236c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74582
@ -140,6 +140,8 @@ void
|
||||
settime(now)
|
||||
time_t now;
|
||||
{
|
||||
char *oldl;
|
||||
|
||||
tp = localtime(&now);
|
||||
if ( isleap(tp->tm_year + 1900) ) {
|
||||
yrdays = 366;
|
||||
@ -152,9 +154,10 @@ settime(now)
|
||||
offset = tp->tm_wday == 5 ? 3 : 1;
|
||||
header[5].iov_base = dayname;
|
||||
|
||||
oldl = setlocale(LC_TIME, NULL);
|
||||
(void) setlocale(LC_TIME, "C");
|
||||
header[5].iov_len = strftime(dayname, sizeof(dayname), "%A", tp);
|
||||
(void) setlocale(LC_TIME, "");
|
||||
(void) setlocale(LC_TIME, oldl);
|
||||
|
||||
setnnames();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user