Could you tell me what does the code in this line mean?
if ((year//4 = 0) and (year//400 != 0))
https://en.wikipedia.org/wiki/Leap_year
ok i have a problem using the command arraywrite
arraywrite ndays,[0,31,28,31,30,31,30,31,31,30,31,30,31]
numofdays=ndays[month
what version of pbp , what error
what actual code , snippets of code are pointless for debugging
is syntactically correct for PBP3 the byte vars ndays and month also need to have been declared
eg
ndays var byte[13]
month var byte
your not executing the required steps in any sort of logical order , work out what steps are required then what order the must be done in
Code:
day_added = 0
hh = hh + 3 'the Hour from GPS is UTC so for our country in Greece we add +3
if hh > 23 then 'if the hh+3 hour is greater than 23 (23:00) then
day_added = 1 'we check the day added is true
endif
hh = hh//24 'but the hour not exceed the 24 so go to 00:00
if day_added = 1 then 'now if day added is true
day = day + 1 'then ADD 1 day
if day > Numofdays then 'if day is greater than the numbers of the days in this month
how can you test if day is greater than the month has before you have looked up how many days the month has ?
lookup month,[0,31,28,31,30,31,30,31,31,30,31,30,31],numofdays 'here it is suppose to look at a table NDAYS for each month
day = 1 'then day goes to number 1
if month > 12 then 'if month is greater than 12 which is December
month = 1 ' then month will go to 1, January
year = year +1 ' and the year will increase by 1
what is the point of checking if its a leapyear and the month is feb after you have already tested the number of days for month limit
if ((year//4 = 0) and (year//400 != 0)) then
year = 1
if month = 2 then numofdays = numofdays + 1
endif
endif
endif
endif
Bookmarks