1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Backport changes to AST time library from ksh 93v- beta

This incorporates the last changes in the tm library before AT&T
laid off the AST developers. It contains mostly time zone and
locale related changes/fixes.

I was hoping these would fix #52 (locale-based 'printf %T' output
is broken), but no such luck. This is probably good to have anyway.
This commit is contained in:
Martijn Dekker 2021-01-21 13:45:05 +00:00
parent 0a10e76ccc
commit 9f43f8d10b
6 changed files with 151 additions and 44 deletions

View file

@ -1,7 +1,7 @@
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
@ -14,9 +14,9 @@
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* Glenn Fowler <glenn.s.fowler@gmail.com> *
* David Korn <dgkorn@gmail.com> *
* Phong Vo <phongvo@gmail.com> *
* *
***********************************************************************/
#pragma prototyped
@ -247,6 +247,10 @@ tmlocal(void)
else if (e)
environ[0] = e;
}
#endif
#if _dat_tzname
local.standard = strdup(tzname[0]);
local.daylight = strdup(tzname[1]);
#endif
tmlocale();
@ -292,8 +296,10 @@ tmlocal(void)
* POSIX
*/
local.standard = strdup(tzname[0]);
local.daylight = strdup(tzname[1]);
if (!local.standard)
local.standard = strdup(tzname[0]);
if (!local.daylight)
local.daylight = strdup(tzname[1]);
}
else
#endif
@ -375,6 +381,23 @@ tmlocal(void)
}
}
}
if (!*local.standard && !local.west && !local.dst && (s = getenv("TZ")))
{
if ((zp = tmzone(s, &t, NiL, NiL)) && !*t)
{
local.standard = strdup(zp->standard);
if (zp->daylight)
local.daylight = strdup(zp->daylight);
local.west = zp->west;
local.dst = zp->dst;
}
else
local.standard = strdup(s);
if (!local.standard)
local.standard = "";
if (!local.daylight)
local.daylight = "";
}
/*
* set the options