embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: !DATE

From: Leon Wagner <leon_at_forth.com>
Date: Fri, 31 May 2002 13:39:18 -0700

There are two options if you're really worried about that 1-second rollover:

1) Always set date and time simultaneously with !NOW. This is the preferred
method.

2) Wait for second to roll over before setting new date. This works without any
loss of time only if the fractional seconds is not reset by setting the time.
This depends on your RTC. But you may have to wait a whole second before
setting the date.

A variation on option 2 is to sunchronize RTC writes with the second rollover.
This works best if the RTC can generate an interrupt on each rollover.

> -----Original Message-----
> From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
> Of Bulgrien, Dennis
> Sent: Friday, May 31, 2002 12:51 PM
> To: swiftx_at_forth.com
> Subject: [swiftx] !DATE
>
>
>
> SwiftForth contains a word called !DATE to set the system date to a given
> value. SwiftX does not. A poor implmentation is
> : !DATE ( y d m -- ) ROT D/M/Y @TIME ROT !NOW ;
>
> I say it is poor because fetching the time and then resetting the time to
> that fetched time must lose a finite amount of time between the fetch and
> the set. Though that time will never amount to a second, the resolution of
> !NOW, it will drop a whole second if the time is fetched a microsecond
> before the clock rolls over to a new second but stored a microsecond after.
>
> Has anyone come up with a better implementation?
> ----------------------------------------------------------------------
> swiftx_at_forth.com The SwiftX programming discussion email list
> To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
> For help with listar commands, send subject "help" to listar_at_forth.com
> Archives are located at http://www.forth.com/swiftx -- check them out!
> ----------------------------------------------------------------------
> THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.

----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Fri May 31 2002 - 13:39:32 PDT

This archive was generated by hypermail 2.2.0 : Mon Dec 01 2008 - 03:04:47 PST