Hi, honestly this is currently just for my lazyness:) in doubt i did choose the one below i know i want, but was thinking if maybe the timestamp should be set like this instead however to be more useful to all: limit->timestamp = sensor.tv.tv_sec ? sensor.tv.tv_sec : this_check;
-Artturi diff --git usr.sbin/sensorsd/sensorsd.c usr.sbin/sensorsd/sensorsd.c index 680bc8af9ad..93a2c3bf5de 100644 --- usr.sbin/sensorsd/sensorsd.c +++ usr.sbin/sensorsd/sensorsd.c @@ -57,6 +57,7 @@ struct limits_t { char *command; /* failure command */ time_t astatus_changed; time_t ustatus_changed; + time_t timestamp; /* last value update */ enum sensor_status astatus; /* last automatic status */ enum sensor_status astatus2; enum sensorsd_s_status ustatus; /* last user-limit status */ @@ -368,6 +369,7 @@ check_sdlim(struct sdlim_t *sdlim, time_t this_check) limit->astatus2 = limit->astatus = newastatus; limit->astatus_changed = this_check; + limit->timestamp = sensor.tv.tv_sec; } } } @@ -393,6 +395,7 @@ check_sdlim(struct sdlim_t *sdlim, time_t this_check) limit->ustatus2 = limit->ustatus = newustatus; limit->ustatus_changed = this_check; + limit->timestamp = sensor.tv.tv_sec; } } } @@ -580,6 +583,10 @@ report_sdlim(struct sdlim_t *sdlim, time_t last_report) s); break; } + case 'u': + r = snprintf(&buf[n], len - n, "%lld", + limit->timestamp); + break; case '2': r = snprintf(&buf[n], len - n, "%s", print_sensor(limit->type, diff --git usr.sbin/sensorsd/sensorsd.conf.5 usr.sbin/sensorsd/sensorsd.conf.5 index 84e4053abcc..9f350a831f4 100644 --- usr.sbin/sensorsd/sensorsd.conf.5 +++ usr.sbin/sensorsd/sensorsd.conf.5 @@ -110,6 +110,8 @@ The sensor status. The xname of the device the sensor sits on. .It %t The type of sensor. +.It %u +The timestamp of current value. .It %2 The sensor's current value. .It %3