humax# diff -u /mod/webif/html/sched/visual/index.jim~ /mod/webif/html/sched/visual/index.jim
--- /mod/webif/html/sched/visual/index.jim~
+++ /mod/webif/html/sched/visual/index.jim
@@ -306,7 +306,7 @@
set tomorrow {}
# Midnight today.
- set day [clock scan "00:00:00" -format "%T"]
+ set day [expr [clock seconds] - [clock seconds] % 86400]
set elength [llength $events]
set eindex 0
static int clock_cmd_scan(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
char *pt;
struct tm tm;
- time_t now = time(0);
+ /*time_t now = time(NULL);*/
and
- /* Initialise with the current date/time */
- localtime_r(&now, &tm);
+ /* Set unspecified fields to 0, e.g. HH:MM becomes 00:00 */
+ memset(&tm, 0, sizeof(tm));
+ /* But this is 1-based */
+ tm.tm_mday = 1;
This is especially important if you are going to feed the result back into mktime(), which is exactly what happens.In principle, this function does not initialize tm but stores only the values specified. This means that tm should be initialized before the call.
html/xepg/index.jim: set tt [clock scan \
lib/rsv.class: set stamp [clock scan $spaced -format "%Y %m %d %H %M %S"]
lib/rsv.class: set today [clock scan 00:00:00 -format "%T"]
Your recmon.log error is from yesterday with the previous incompatible version of rs.Yes I am on rs version 1.5.1-2 and have all the beta updates
I think it's a bug. The doc for the JimOK, found it. Here's the commit that changed the behaviour: https://repo.or.cz/jimtcl.git/commitdiff/f85a6e7c5a6387d721f19335984a838863237131
...
Docs. for strptime(), which is called immediately afterwards, say:
This is especially important if you are going to feed the result back into mktime(), which is exactly what happens.
But is it a bug in Jim or not? That is debatable.
clock
command says: ...
clock format seconds ?-format format?
Format the given time (seconds since the epoch) according to the given format. See strftime(3) for supported formats. If no format is supplied, "%c" is used.
clock scan str -format format
Scan the given time string using the given format string. See strptime(3) for supported formats.
...
localtime
. If I want to convert some time in 1970 I'd expect to have to mention 1970 in the time string.tm_mday
is a bit pointless since it should be set when mktime
is called and canonicalizes the struct tm
, but the is_dst
member ought to be set to a negative value (since strptime
provides no way to specify the DST setting).Even if it would have been reasonable to expect the clock scan approach to work, I can't disagree with that.The documentation is hardly explicit about what it's supposed to do.
IMO, you are somewhat abusing clock scan and getting it to do something it probably wasn't really designed to do, and the result you wanted was just a side-effect that happened to work at some points in time, and now doesn't.
My solution above would appear to be the correct one regardless.
There always is one.I expect there might be a DST problem here though, but I think there always might have been?
...
The Visual displays have always had problems around the Clock changeI expect there might be a DST problem here though, but I think there always might have been?
>>> Beginning diagnostic rs/checkin
Running: rs/checkin
/mod/sbin/rs_process:62: Error: child killed by signal SIGSEGV
in procedure 'push' called at file "/mod/sbin/rs_process", line 76
at file "/mod/sbin/rs_process", line 62
>>> Ending diagnostic rs/checkin
Yes, RS 1.5.1-2 is installed.As post #5... are you running rs 1.5.1-2 ?
It wasn't intended to - 1.4.4-7 should do that.I am not sure whatWeb interface version: 1.4.4-6
was intended to fix but it hasn't corrected the Visual display problem
Thanks prpr! There's a small race condition in this and since Jim will use integer arithmetic unless one of the operands is decimal, I went for this:+ set day [expr [clock seconds] - [clock seconds] % 86400]
It doesIt wasn't intended to - 1.4.4-7 should do that.