Skip to content

Commit edd82e4

Browse files
Use millisecond timestamp for events
1 parent 362d612 commit edd82e4

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

houserelays.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ int main (int argc, const char **argv) {
227227

228228
echttp_static_route ("/", "/usr/local/share/house/public");
229229
echttp_background (&hc_background);
230-
houselog_event (time(0), "SERVICE", "relays", "START", "ON %s", HostName);
230+
houselog_event ("SERVICE", "relays", "START", "ON %s", HostName);
231231
echttp_loop();
232232
}
233233

houserelays_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const char *houserelays_config_load (int argc, const char **argv) {
9898
ConfigFile = strdup(argv[i] + 9);
9999
}
100100
}
101-
houselog_event (time(0), "SYSTEM", "CONFIG", "LOAD", "FILE %s", ConfigFile);
101+
houselog_event ("SYSTEM", "CONFIG", "LOAD", "FILE %s", ConfigFile);
102102
return houserelays_config_refresh (ConfigFile);
103103
}
104104

@@ -110,7 +110,7 @@ const char *houserelays_config_update (const char *text) {
110110
if (fd >= 0) {
111111
write (fd, text, strlen(text));
112112
close (fd);
113-
houselog_event (time(0), "SYSTEM", "CONFIG", "UPDATED", "FILE %s", ConfigFile);
113+
houselog_event ("SYSTEM", "CONFIG", "UPDATED", "FILE %s", ConfigFile);
114114
}
115115
return houserelays_config_refresh (ConfigFile);
116116
}

houserelays_gpio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ int houserelays_gpio_set (int point, int state, int pulse) {
200200
state?Relays[point].on:Relays[point].off);
201201
if (pulse > 0) {
202202
Relays[point].deadline = time(0) + pulse;
203-
houselog_event (now, "GPIO", Relays[point].name, namedstate,
203+
houselog_event ("GPIO", Relays[point].name, namedstate,
204204
"FOR %d SECONDS", pulse);
205205
} else if (pulse < 0) {
206206
Relays[point].deadline = 0;
207-
houselog_event (now, "GPIO", Relays[point].name, namedstate,
207+
houselog_event ("GPIO", Relays[point].name, namedstate,
208208
"END OF PULSE");
209209
} else {
210210
Relays[point].deadline = 0;
211-
houselog_event (now, "GPIO", Relays[point].name, namedstate, "LATCHED");
211+
houselog_event ("GPIO", Relays[point].name, namedstate, "LATCHED");
212212
}
213213
Relays[point].commanded = state;
214214
return 1;

public/events.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
}
4747
for (var i = response.relays.events.length-1; i >= 0; --i) {
4848
var event = response.relays.events[i];
49-
var timestamp = new Date(event[0] * 1000);
49+
var timestamp = new Date(event[0]);
5050
var row = document.createElement("tr");
5151
row.appendChild(newColumn(timestamp.toLocaleString()));
5252
row.appendChild(newColumn(event[1]));

0 commit comments

Comments
 (0)