Jump to content

Recommended Posts

Posted

Hi All,

Just wanted to share this,

Using this formula;

( 1 + ( Y * 5 / 4 )

Y = SI-33 (Current Year Value from RTC)

Results = MI-95

Than take the results and put them into the Modulo (%) function

A = MI-95

B = D#7

C = MI-96

Now determining the Start Date in March, use the SUB function (14-MI96=MI97)

A = D#14

B = MI-96

C = MI-97 answer = 13

do the same for the End Date in November, use the SUB function (7-MI96=MI98)

A = D#7

B = MI-96

C = MI-98 answer = 6

Multiply MI-97 by 100 and then add 3 to get a value of 1303, March 13 is the DST start date for 2011

Multiply MI-98 by 100 and then add 11 to get a value of 611, November 6 is the DST end Date for 2001

Now that we know the dates we can add in the other data and then create a UTC of the start and end dates

using the store function add the other known values;

MI-100 RTC Seconds SS (0) is 00 seconds

MI-101 RTC Hour and Minutes HHMM (200) is 2:00am

MI-102 RTC Day and Month DDMM (1303) is 13th of March (MI-97)

MI-103 RTC Year (2011) is current Year

MI-104 RTC DOW (1) is Sunday

Do the same for the End Date

MI-110 RTC Seconds SS (0) is 00 seconds

MI-111 RTC Hour and Minutes HHMM (200) is 2:00am

MI-112 RTC Day and Month DDMM (611) is 6th of November (MI-98)

MI-113 RTC Year (2011) is current Year

MI-114 RTC DOW (1) is Sunday

Then use the RTC to UTC function,

MI-100 to DW-1 value for 2011, 13th of March @ 2:00am on Sunday should be 3508970400

MI-110 to DW-2 value for 2011, 6th of November @ 2:00am on Sunday should be 3529533600

Now we just need to see if the current RTC in SI-30 to UTC once every hour is in or out of the above range and set or reset bits or better yet save to a data table a bit for DST status.

If you need an example, let know, I'll see if I can attach one after deleting other attachments so that I can, as I think I'm at my 500K global upload limit.

Deke

Posted

Hi Deke,

Thank you for sharing your idea. I guess many customers will find it useful, but I - sorry to say - find it a little complicated.

In general - this to pic is complicated. Each country has its own rules. In general, the date is "the last Saturday of month..." or something similar.

I think it is easier to use Calendar (Time) functions and to define the role in specific country.

In VisiLogic, there needs to be a simple demo to show the idea.

Posted

Ok,

Here is an example for the V570.

Deke

EDIT: I removed the Example, as I had one bug in that example as I forgot to change a MI value, (trouble with copying and pasting), MI-102 was in there twice when the second one should have been MI-112..

Anyways, this formula works for any time zone! yes that is right! :P You just need to change the 2 values, currently for the US the second week in march starts the DST and the value of 14 was used to determine the start date Now if you wanted this for the UK, 28 would be used instead 14 and instead of 7 for the End date it would be 31. Then of course instead of 2:00 am for the starting time it would be 1:00 am, Just a few changes here and there and it will work.

I have trimmed the logic a bit, if anyone is interested I will re-post a newer version, and yes I will make sure there are no mistakes. :blink:

Having fun,

Deke:D

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.