Hi all,

new to this forum - hmm. I don't seem to be able to reply to forum posts yet. Well:

I can find several posts with 'one-hour-off' issues, and I have the same issue with my Meade ETX90.

I get around this by changing the INDI settings in KStars (to not touch date/time in the mount), but I have spent way too many hours finding this issue.

Think I have narrowed it down a bit below, by testing the UTC calculation when DST is active, and when it is inactive.

The test show that DST active, gives a one hour off calculation, whereas DST inactive, gives a correct calculation.

The calculation is performed in lx200telescope.cpp

I'm not a c++ programmer, so I'm not able to create a patch.


The test is:


Location: Denmark
Timezone: GMT+1
Timeformat: 24
Local time - yyyy-mm-ddThh:mm:ss: 2023-04-06T10:01:38
DST is active
UTC is - yyyy-mm-ddThh:mm:ss: 2023-04-06T08:01:38
INDI settings in KStars: Mount Updates KStars. Time and Location checkboxes are checked.


:GG# is: Get UTC offset time
:GL# is: Get Local Time in 24 hour format
:GC# is: Get current date

KStars log show:
[2023-04-06T10:01:40.502 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] CMD <:GG#> "
[2023-04-06T10:01:40.502 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] RES <-02> "
[2023-04-06T10:01:40.503 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] VAL [-2] "
[2023-04-06T10:01:40.503 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] CMD <:GL#> "
[2023-04-06T10:01:40.503 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] RES <10:01:38> "
[2023-04-06T10:01:40.503 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] VAL [10.0272] "
[2023-04-06T10:01:40.503 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] <getCalendarDate> "
[2023-04-06T10:01:40.503 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] CMD <:GC#> "
[2023-04-06T10:01:40.503 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] RES <04/06/23> "
[2023-04-06T10:01:40.504 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[DEBUG] Mount controller UTC Time: 2023-04-06T09:01:38 "
[2023-04-06T10:01:40.504 CEST DEBG ][ org.kde.kstars.indi] - ETX90 : "[DEBUG] Mount controller UTC Offset: 2.00 "


i.e. the calculation of UTC from local time, is one hour off, it should read: 2023-04-06T08:01:38

Right after this has been calculated, KStars updates the local time to 11:01:38, where local time is actually 10:01:38.


Doing the same test when DST is not active, correctly gives:
Location: Denmark
Timezone: GMT+1
Timeformat: 24
Local time - yyyy-mm-ddThh:mm:ss: 2023-02-06T10:01:17
DST is inactive
UTC is - yyyy-mm-ddThh:mm:ss: 2023-02-06T09:01:17
INDI settings in KStars: Mount Updates KStars. Time and Location checkboxes are checked.

KStars log show:
[2023-02-06T10:01:18.677 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] CMD <:GG#> "
[2023-02-06T10:01:18.677 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] RES <-01> "
[2023-02-06T10:01:18.677 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] VAL [-1] "
[2023-02-06T10:01:18.678 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] CMD <:GL#> "
[2023-02-06T10:01:18.678 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] RES <10:01:17> "
[2023-02-06T10:01:18.678 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] VAL [10.0214] "
[2023-02-06T10:01:18.678 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] <getCalendarDate> "
[2023-02-06T10:01:18.678 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] CMD <:GC#> "
[2023-02-06T10:01:18.678 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[SCOPE] RES <02/06/23> "
[2023-02-06T10:01:18.678 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[DEBUG] Mount controller UTC Time: 2023-02-06T09:01:17 "
[2023-02-06T10:01:18.678 CET DEBG ][ org.kde.kstars.indi] - ETX90 : "[DEBUG] Mount controller UTC Offset: 1.00 "



The calculation takes place in:
github.com/indilib/indi/blob/602be288b3a...e/lx200telescope.cpp

in the function: bool LX200Telescope::sendScopeTime()

and I assume it is the snippet:

ltm.tm_isdst = 0;
// Get local time epoch in UNIX seconds
time_epoch = mktime(<m);

that always sets DST to inactive (ltm.tm_isdst = 0).

Regards,
MBantz

Read More...