I see this topic has come up again, and I have been thinking about it since I
started the thread (sorry it took me so long to get back to it).
I agree with Tom's reluctance to have Weewx use the console as a RTC. I did
some research and it seems actually adding the console as a RTC that NTPd can
access would be hard since Weewx wants to control the USB, and, as far as I
was able to determine there is no support for RTC connected via USB.
I believe we can solve this entirely within the init startup script.
Previously I suggested waiting until the clock got set, and then starting.
Tom pointed out there is a command for getting the console time and that the
time could be scraped from there. I don't have access to my station at this
point, so I haven't been able to implement or test this approach.
So here is what I think could be done without a lot effort, and it would solve
the problem of hardware that doesn't have it's own RTC, this is done entirely
in the init script, nothing is changed in Weewx:
1) The script starts by checking to see if the clock is set, it can do this
by testing the the year with something like 'date +%Y' and seeing if it is
>2000 (IE are we in the right century).
2) If the clock doesn't appear to be set wait 1 minute and try again. Do
this a maximum of say 5 times (a typical archive interval). If ever it
appears to be set, start Weewx normally (IE using the computer time).
3) If after the maximum number of checks the clock still isn't set, then use
the command Tom cited to grab the time from the console. Scrape the values
needed and set the computer clock (this can be done since the init script is
still running as root and hasn't switched userid yet), then start Weewx.
I believe this solution is not much more than 1-2 dozen lines of scripting and
it will solve the clock problem for devices without hardware.
Bill
On Tuesday 19 March 2013 16:56, Thomas Keffer wrote:
> On Tue, Mar 19, 2013 at 11:42 AM, Bill <
boob...@rogers.com> wrote:
> > Tom,
> >
> > Weewx is syncing the console clock to the computer clock by default?
> > What happens if the computer clock is wrong, does it mess up the console?
>
> Yup. But, they'll be in synch! :-)
>
> > This gives me another idea ... maybe there could be an option in
> > weewx.conf for computers that don't have hardware clocks. In this case
> > the default would be to sync the computer's clock to the console? This
> > would be justified since the console has a clock and it has battery
> > backup.
>
> Are you suggesting that the console be used to set the computer's clock? If
> so, I don't like the idea of including that in weewx. It would require root
> privileges, and it's really outside the scope of what weewx is intended to
> do.
>
> However, what you could do is run wee_config_vantage with the
> --infooption, which, among other things, prints out the console's