aboutsummaryrefslogtreecommitdiffstats
path: root/DateMeter.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2021-09-21 08:35:20 +0200
committerDaniel Lange <DLange@git.local>2021-09-21 08:35:20 +0200
commita2b6942d15d220bb0518003d4f818a922d88e9f9 (patch)
tree7f60a44dec34af24da75b8d5b68c88eca94b9f6a /DateMeter.c
parent37d8824862a2f6b9375022e1c45ba4548162650f (diff)
parent69f439eff387a6ecb52734e400b297a3c85f2285 (diff)
downloaddebian_htop-a2b6942d15d220bb0518003d4f818a922d88e9f9.tar.gz
debian_htop-a2b6942d15d220bb0518003d4f818a922d88e9f9.tar.bz2
debian_htop-a2b6942d15d220bb0518003d4f818a922d88e9f9.zip
Update upstream source from tag 'upstream/3.1.0'
Update to upstream version '3.1.0' with Debian dir d4ecdd99a38d7105de46689cebcb051bf0046a76
Diffstat (limited to 'DateMeter.c')
-rw-r--r--DateMeter.c14
1 files changed, 8 insertions, 6 deletions
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 <time.h>
+#include <sys/time.h>
#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 = {

© 2014-2024 Faster IT GmbH | imprint | privacy policy