forked from enlightenment/enlightenment
e clock calendar: complexity--.
No need to check whether day names is already got for each day when it can be done once. Not sure why they are cleared and recreated at every month change. SVN revision: 72275
This commit is contained in:
parent
c1bc43f14c
commit
985a236370
|
@ -114,7 +114,17 @@ _time_eval(Instance *inst)
|
||||||
memcpy(&tmm, tm, sizeof(struct tm));
|
memcpy(&tmm, tm, sizeof(struct tm));
|
||||||
if (!started)
|
if (!started)
|
||||||
{
|
{
|
||||||
if (tm->tm_wday == inst->cfg->week.start) started = 1;
|
if (tm->tm_wday == inst->cfg->week.start)
|
||||||
|
{
|
||||||
|
char buf[32];
|
||||||
|
|
||||||
|
for (i = 0; i < 7; i++, tm->tm_wday = (tm->tm_wday + 1) % 7)
|
||||||
|
{
|
||||||
|
strftime(buf, sizeof(buf), "%a", tm);
|
||||||
|
inst->daynames[i] = eina_stringshare_add(buf);
|
||||||
|
}
|
||||||
|
started = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
|
@ -145,14 +155,6 @@ _time_eval(Instance *inst)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!inst->daynames[x])
|
|
||||||
{
|
|
||||||
char buf[32];
|
|
||||||
|
|
||||||
buf[sizeof(buf) - 1] = 0;
|
|
||||||
strftime(buf, sizeof(buf) - 1, "%a", (const struct tm *)&tmm); // %A full weekeday
|
|
||||||
inst->daynames[x] = eina_stringshare_add(buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue