From 69f439eff387a6ecb52734e400b297a3c85f2285 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Tue, 21 Sep 2021 08:35:19 +0200 Subject: New upstream version 3.1.0 --- DateMeter.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'DateMeter.c') diff --git a/DateMeter.c b/DateMeter.c index bd6a306..d01f464 100644 --- a/DateMeter.c +++ b/DateMeter.c @@ -10,28 +10,30 @@ in the source distribution for its full text. #include "DateMeter.h" #include +#include #include "CRT.h" #include "Object.h" +#include "ProcessList.h" static const int DateMeter_attributes[] = { DATE }; -static void DateMeter_updateValues(Meter* this, char* buffer, size_t size) { - time_t t = time(NULL); +static void DateMeter_updateValues(Meter* this) { + const ProcessList* pl = this->pl; + struct tm result; - struct tm* lt = localtime_r(&t, &result); + const struct tm* lt = localtime_r(&pl->realtime.tv_sec, &result); this->values[0] = lt->tm_yday; int year = lt->tm_year + 1900; if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { this->total = 366; - } - else { + } else { this->total = 365; } - strftime(buffer, size, "%F", lt); + strftime(this->txtBuffer, sizeof(this->txtBuffer), "%F", lt); } const MeterClass DateMeter_class = { -- cgit v1.2.3