RE: caching of the real-time clock value
"Kelly Smith" <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
Why not just get the time off of the WWW for your TINI, at: 132.163.4.102? Example: tini00e16c /> date -n 132.163.4.102 Synchronizing time to server: time-B.timefreq.bldrdoc.gov/132.163.4.102 New system time: 26 Apr 2004 21:38:38 GMT Best regards, Kelly Smith -----Original Message----- From: tini-admin-6tN4nzCoH/[email protected] [mailto:tini-admin-6tN4nzCoH/[email protected]]On Behalf Of Bryan Armstrong Sent: Monday, April 26, 2004 9:57 AM To: Aaron Buchanan Cc: 'tini-6tN4nzCoH/[email protected]' Subject: Re: [TINI]caching of the real-time clock value Aaron Buchanan wrote: > I am observing problems with the consistency of calls to > System.currentTimeMillis(). It appears that reads to the real time clock > chip are getting cached and System.currentTimeMillis is incremented based on > the OS tick. This results in time progressing incorrectly when compared to > an external (non-TINI board) source. On a periodic basis (every 10 mins) it > looks like the real-time clock gets read and System.currentTimeMillis jumps > to the current(RTC) time. I've been observing this problem in a number of > ways, but the easiest is with a simple test loop such as: You are correct. The DS1672 RTC has a 1 second resolution and the TINIOS is synchronizing the system 1ms timer every 10 minutes to allow higher resolution. Assuming the CPU is running at 14.7456MHz, the 16 bit timer for the 1ms tick will have a 162 nanosecond overshoot per tick. This adds up to approximately 97 milliseconds every 10 minutes. The resync is sampled every IO_Poll (approx every 4ms) for one second to tick over on the DS1672. > try { Thread.sleep(1000); } catch (Exception ie) {} The Thread.sleep() function call is not guaranteed to return in the time requested per the Java specification. This could also lead to variance in the timing. > Can anyone confirm the reasons for this 10 minute reset/anomaly I'm seeing > in time reading? Is there a way to always read from the RTC? If I used the > System_GetRTCRegisters native api function will it return the raw RTC value, > or is it being cached also? The native function grabs the system time plus offset just as the currentTimeMillis() function does. You can always divide the current time by 1000 to get a seconds count that equals the value of the RTC. -- -- Bryan Armstrong bryan.armstrong-6tN4nzCoH/[email protected] _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini