4 Star 8 Fork 0

Gitee 极速下载 / htop

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/htop-dev/htop
克隆/下载
DateTimeMeter.c 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
Benny Baumann 提交于 2023-11-28 15:15 . Update includes based on IWYU
/*
htop - DateTimeMeter.c
(C) 2004-2020 Hisham H. Muhammad, Michael Schönitzer
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h" // IWYU pragma: keep
#include "DateTimeMeter.h"
#include <time.h>
#include <sys/time.h>
#include "CRT.h"
#include "Machine.h"
#include "Object.h"
static const int DateTimeMeter_attributes[] = {
DATETIME
};
static void DateTimeMeter_updateValues(Meter* this) {
const Machine* host = this->host;
struct tm result;
const struct tm* lt = localtime_r(&host->realtime.tv_sec, &result);
int year = lt->tm_year + 1900;
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
this->total = 366;
} else {
this->total = 365;
}
this->values[0] = lt->tm_yday;
strftime(this->txtBuffer, sizeof(this->txtBuffer), "%F %H:%M:%S", lt);
}
const MeterClass DateTimeMeter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete
},
.updateValues = DateTimeMeter_updateValues,
.defaultMode = TEXT_METERMODE,
.maxItems = 1,
.total = 365,
.attributes = DateTimeMeter_attributes,
.name = "DateTime",
.uiName = "Date and Time",
.caption = "Date & Time: ",
};
C
1
https://gitee.com/mirrors/htop.git
git@gitee.com:mirrors/htop.git
mirrors
htop
htop
main

搜索帮助