forked from enlightenment/efl
handle tz updates with localtime - limit calls to more than 1 second apart.
SVN revision: 34553
This commit is contained in:
parent
c014ed5267
commit
ad70ab93f4
|
@ -29,6 +29,7 @@ _embryo_time_seconds(Embryo_Program *ep __UNUSED__, Embryo_Cell *params __UNUSED
|
||||||
static Embryo_Cell
|
static Embryo_Cell
|
||||||
_embryo_time_date(Embryo_Program *ep, Embryo_Cell *params)
|
_embryo_time_date(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
{
|
{
|
||||||
|
static time_t last_tzset = 0;
|
||||||
struct timeval timev;
|
struct timeval timev;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
time_t tt;
|
time_t tt;
|
||||||
|
@ -36,6 +37,11 @@ _embryo_time_date(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
if (params[0] != (8 * sizeof(Embryo_Cell))) return 0;
|
if (params[0] != (8 * sizeof(Embryo_Cell))) return 0;
|
||||||
gettimeofday(&timev, NULL);
|
gettimeofday(&timev, NULL);
|
||||||
tt = (time_t)(timev.tv_sec);
|
tt = (time_t)(timev.tv_sec);
|
||||||
|
if ((tt - last_tzset) < 1)
|
||||||
|
{
|
||||||
|
last_tzset = tt;
|
||||||
|
tzset();
|
||||||
|
}
|
||||||
tm = localtime(&tt);
|
tm = localtime(&tt);
|
||||||
if (tm)
|
if (tm)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue