Help with Summer and Winter time ..

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all.

I make small GSM application and get Rela time from NTP server by GPRS (use Telit module).

All work good .. just need to know how to calculate if is Winter or Summer time .. 

I try look to time.h from libc .. but not find it ..  how to calculate ..???

 

regards..

 

*Corrected spelling in title. Moderator*

Last Edited: Mon. Oct 26, 2015 - 10:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Without a known location (sometimes time-zone is enough, sometimes you need to know country/state) this can not be determined.

 

If you know the country you can implement code to determine if a certain date/time falls in DST (summer) or "standard time" (winter). It would have to implement this table or something similar.

 

Please note that there is a span of one hour every year when you can not determine if that time is summer or winter time.

 

There is no support in avrlibc for this, as far as I know. You will have to code for it yourself (or use some 3rd party software if you find such).

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.

My location is central Europe .. Slovak Republik ..

If I update time in my GSM .. just use this command: AT#NTP="ntp.bts.sk",123,1,2,8 and this give me Summer time .. last digit 8 define 8* (quarter of hour) .. it's 2hour + to GMT time.. all is OK..

if want winter time then last digit give 4 .. it's +1 hour to GMT .. 

I will update time with AT#NTP="ntp.bts.sk",123,1,2,4 (+1) and then calculate if manual add one hour more or not .. 

 

In Slovak Republik is used law : Summer time is set Last Sunday of March , and Winter time is set last Sunday in October .. and this law is exactly ..

but I don't want write the huge code to check it ..

 

any suggestion  ??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The current release of AVR-Libc (1.8.1) does have DST functionality... you are using an older version. 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mikericetga write more pls.. about it ..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mikericetga wrote:
The current release of AVR-Libc (1.8.1) does have DST functionality

Oh... I stand corrected then.

 

Of-course I went off to read up on the documentation. But...

1) The avrlibc web-page has not been updated since sometime between Herodes and Charlemaigne..

2) Atmel Studio 7, or rather the avr-gcc version of the tool chain that comes with it, does not support it (at least there is no time.h in the toolchain tree), so..

3) Neither Studio's help nor Atmels online avrlibc documentation  mentions e.g. <time.h> AFAICT.

 

So, the option is to build avrlibc yourself to get this?

 

EFDIT: Turns out I was wrong again. There is documentation of time.h on the avrlibc site: http://www.nongnu.org/avr-libc/u... .

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Mon. Oct 26, 2015 - 02:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I find in one very old program what I use similar function .. try check it .. 

I write result..

 

regarst..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

but I don't want write the huge code to check it ..

From ancient memory,  localtime() should set the daylight savings time for you.   If you have the relevant fields in your $(TIMEZONE) environment variable.

 

If the GCC library does not do it,  it is not too difficult to parse it for yourself.    Incidentally,   Brits change from GMT to BST on the same day.    Also from memory,   we do it at 01.00 on the Sunday morning going forwards and 02.00 when we go backwards.    Personally,   I am fast asleep.    But I did get up once to watch my MSF kitchen clock hands change the time automatically.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Someguy22,

 

Have you ever heard a more pathetic idiot talking more rubbish than this guy?

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used to have a script which would install the time functions into a pre-existing toolchain. If anyone is interested I may dust it off.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0