diff options
author | Daniel Lange <DLange@git.local> | 2021-09-21 08:35:19 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2021-09-21 08:35:19 +0200 |
commit | 69f439eff387a6ecb52734e400b297a3c85f2285 (patch) | |
tree | 2a988b7868b749654796183ba70b4272965da1bf /DateTimeMeter.c | |
parent | c55320e9e2a8916e911bcd39ab37b79e3a7d03b2 (diff) | |
download | debian_htop-upstream/3.1.0.tar.gz debian_htop-upstream/3.1.0.tar.bz2 debian_htop-upstream/3.1.0.zip |
New upstream version 3.1.0upstream/3.1.0
Diffstat (limited to 'DateTimeMeter.c')
-rw-r--r-- | DateTimeMeter.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/DateTimeMeter.c b/DateTimeMeter.c index 0d231cd..a042a61 100644 --- a/DateTimeMeter.c +++ b/DateTimeMeter.c @@ -10,28 +10,30 @@ in the source distribution for its full text. #include "DateTimeMeter.h" #include <time.h> +#include <sys/time.h> #include "CRT.h" #include "Object.h" +#include "ProcessList.h" static const int DateTimeMeter_attributes[] = { DATETIME }; -static void DateTimeMeter_updateValues(Meter* this, char* buffer, size_t size) { - time_t t = time(NULL); +static void DateTimeMeter_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); int year = lt->tm_year + 1900; if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { this->total = 366; - } - else { + } else { this->total = 365; } this->values[0] = lt->tm_yday; - strftime(buffer, size, "%F %H:%M:%S", lt); + strftime(this->txtBuffer, sizeof(this->txtBuffer), "%F %H:%M:%S", lt); } const MeterClass DateTimeMeter_class = { |