Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:30 07 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Day of week from GPS time GMT/BST

     Page 2 of 2    
Author Message
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 09:58am 21 Jun 2016
Copy link to clipboard 
Print this post

I have just seen a line of code where you set mth=mth-1. This could also be causing your issue!
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 10:06am 21 Jun 2016
Copy link to clipboard 
Print this post

mth = mth - 1

is in Geoff's original GPS code, and your's from the page before this one

I was wondering what it was for - or what it did - I still don't know


if no GPS data is received then it goes back to "searching for satellites"

EDIT:

I've just loaded up the gps clock program on it's own with nothing else and I'll leave that running overnight and see if any errors "pop up"

I suspect that there will be none, which means that "SOMEHOW" the code for the rest of the weather station is making the gps clock fail - which I cannot understand how it could
Edited by lew247 2016-06-22
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 10:19am 21 Jun 2016
Copy link to clipboard 
Print this post

@lew247

As something we previously discussed; here is the code that has appeared on TBS regarding calculating DOW from date:

dim DOW$(6) length 9
DOW$(0)="Sunday":DOW$(1)="Monday":DOW$(2)="Tuesday":DOW$(3)= "Wednesday"
DOW$(4)="Thursday":DOW$(5)="Friday":DOW$(6)="Saturday"

Year=VAL(MID$(DATE$,7,4)):Month=VAL(MID$(DATE$,4,2)):Day=VAL (MID$(DATE$,1,2))
print DOW$(DayOfWeek(Year, Month, Day))


end


function DayOfWeek(year, month, day)
a = int((14-month)/12)
m = month + 12*a - 2
y = year - a
DayOfWeek = (day + y + int(y/4)-int(y/100)+int(y/400)+int(31*m/12)) mod 7
end function


Originally came from TZA (now MicroBlocks) and modified by Grogster . . . .

 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 01:19am 14 Sep 2016
Copy link to clipboard 
Print this post

Can anyone explain to me how this works?

Looking at it - I can see that if DST occurs, the code adds 60 minutes to the time to correct the clock
However I cannot understand how it removes the 60 mins when the DST changeover occurs

[code] ' convert the time to minutes since midnight 1st Jan 2014
' then add/subtract the timezone and if required add daylight saving
' this calculation takes just 15mS at 40MHz
mins = GetMins(year, month, day, hour, min)
mins = mins + TimeZone * 60 ' adjust for the timezone
If mins < GetDST(year, dme, dhe) Or mins > GetDST(year, dms, dhs) Then
mins = mins + 60 'adjust for AWST DST
EndIf[/code]
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 12:09am 15 Sep 2016
Copy link to clipboard 
Print this post

It doesn't need to remove the 60 minutes, it just does not add it.

It looks like each time it'd called it starts off working from GMT.

Phil.
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025