set_clock script function to set camera date / time - page 2 - General Discussion and Assistance - CHDK Forum
supplierdeeply

set_clock script function to set camera date / time

  • 16 Replies
  • 2133 Views
*

Offline c_joerg

  • *****
  • 1146
Re: set_clock script function to set camera date / time
« Reply #10 on: 28 / August / 2020, 02:20:29 »
Advertisements
[According to the SX260 manual, this seems to be a feature of the stock firmware (page 51 of the English version) under menu item "GPS Auto Time". I
Right. I've never noticed it on my SX230. GPS is also mostly switched off. Should have read the manual ...
M100 100a, M3 101a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline Mlapse

  • ****
  • 308
  • A480 A490 S95 M10
Re: set_clock script function to set camera date / time
« Reply #11 on: 18 / September / 2020, 11:34:41 »
The OS clock is based on a high frequency timer on the SOC which I would expect to be fairly accurate and relatively unaffected by CPU load, but I don't really know.

I've tested that by using old logs and I think you are right, the OS clock is most reliable.
Thank you for this function, it gives me a chance to correct the time during a run.
It is really ashame that reboot does not work on Digic6, i would have liked my m10 to be able to do this.
frustration is a key ingredient in progress

*

Offline Caefix

  • *****
  • 596
  • Sorry, busy deleting test shots...
Re: set_clock script function to set camera date / time
« Reply #12 on: 18 / September / 2020, 15:09:09 »
On cams with GPS. Is it possible to synchronize time with GPS time?
If "GPS Auto Time" is turned off, one could probably get the time from the GPS propcase from script and then use set_clock
gps = require("gpsLib")  8)
The script   test/gps_test.lua   seems to have all the lines You need...
All lifetime is a loan from eternity.

*

Offline reyalp

  • ******
  • 13387
Re: set_clock script function to set camera date / time
« Reply #13 on: 20 / September / 2020, 02:46:25 »
I noticed cameras starting from DryOS R52 have an eventproc GetTimeFromRTC which appears to return a unix-like timestamp, without the DST adjustment.

The underlying function used by the eventproc is also called from task_Startup, via the same function that calls StartWDT. This presumably where the OS clock gets initialized, and an obvious equivalent exists on earlier dryos cams without the event proc.
Don't forget what the H stands for.


*

Offline srsa_4c

  • ******
  • 4426
Re: set_clock script function to set camera date / time
« Reply #14 on: 26 / September / 2020, 13:22:54 »
I noticed cameras starting from DryOS R52 have an eventproc GetTimeFromRTC which appears to return a unix-like timestamp, without the DST adjustment.

The underlying function used by the eventproc is also called from task_Startup, via the same function that calls StartWDT.
I added that to the dryos sigfinder, along with some slightly related functions that I found in the ixus30 firmware earlier.

*

Offline Mlapse

  • ****
  • 308
  • A480 A490 S95 M10
Re: set_clock script function to set camera date / time
« Reply #15 on: 19 / October / 2020, 04:37:01 »
In 5552 I added a lua function set_clock to set the camera date / time.

I did a few tests with going to play, set_clock followed by a reset once a day and later once a week and those all worked out perfectly on a 64GB card.
the only thing i could see in the log was that it skipped 2 lines before resetting the time.
it was already skipping 2 lines on reboot, so that made the "set clock" stand out in the log.
 
so I decided to place it in my running project that reboots after 3 weeks on a 256GB card.
alas it did not work.
because i did not put the proper chdk build on the card, it was still running 5172.
so it halted on the CHDK menu without going past set_clock to the reboot.
human error....the most annoying thing :)

is there a way to check build number without loading it in the cam?
« Last Edit: 19 / October / 2020, 05:21:23 by Mlapse »
frustration is a key ingredient in progress

*

Offline Mlapse

  • ****
  • 308
  • A480 A490 S95 M10
Re: set_clock script function to set camera date / time
« Reply #16 on: 02 / December / 2020, 05:26:25 »
well, I am very happy with set_clock, a very good addition reyalp.
I've used a 35 second correction after 3 weeks.
total run time was little over 31 days.

35 sec. did not completely correct the offset, but it seems some of the unstable side effect of reboot are also fixed.
and that has more value than a few seconds per month too much....
maybe in a few month I'll be able to set the correction to a value that makes a few seconds off per year possible.
but for now I'll accept the few minutes off per year as minor compared to the 40-50 seconds per month I had previously.
herebelow a small portion of the log.

Quote
20201122   165002   Day 22   Sun Nov 22 16:50:02 2020   IMG_0021.JPG   tv:   1/8   f:   3.1   ISO:   75   TV96:   284   AV96:   322   bv:   235   V:   3.949   T:   34   
20201122   165002   Day 22   Sun Nov 22 16:50:02 2020                                                                       set backlight on
20201122   165008   Day 22   Sun Nov 22 16:50:08 2020                                                                       Scheduled reboot
20201122   165008   Day 22   Sun Nov 22 16:50:08 2020                                                                       lens retraction wait
20201122   165020   Day 22   Sun Nov 22 16:50:20 2020                                                                       rebooting now
                                                               
                                                               
20201122   164946   Day 22   Sun Nov 22 16:49:46 2020                                                                       time set
20201122   164953   Day --   Sun Nov 22 16:49:53 2020                                                                       SUIx V0.4.4
20201122   164954   Day --   Sun Nov 22 16:49:54 2020                                                                       Card size 235 Gb Free 105 Gb
20201122   164954   Day --   Sun Nov 22 16:49:54 2020                                                                       CHDK 1.5.0 Oct 19 2020 s95 100k
20201122   165007   Day 1   Sun Nov 22 16:50:07 2020                                                                       Autostarted.  Next reboot:21 days
20201122   165008   Day 22   Sun Nov 22 16:50:08 2020                                                                       Elapsed days = 22
20201122   165009   Day 22   Sun Nov 22 16:50:09 2020                                                                       Oldest image number = 1
20201122   165009   Day 22   Sun Nov 22 16:50:09 2020                                                                       Oldest DCIM folder = 100_0111
20201122   165031   Day 22   Sun Nov 22 16:50:31 2020   IMG_0022.JPG   tv:   1/6   f:   3.1   ISO:   75   TV96:   261   AV96:   322   bv:   212   V:   3.935   T:   33   
« Last Edit: 02 / December / 2020, 05:48:15 by Mlapse »
frustration is a key ingredient in progress

 

Related Topics