Unixdate$

42 views
Skip to first unread message

Fernando Perez

unread,
Nov 28, 2020, 6:03:43 AM11/28/20
to Annex WiFi RDS
Happy day to everyone.
Can you run this piece of code and tell me if you also get a difference of one day in the unixdate$() function with respect to the actual date?
Thank you.

d$ = date$
d = dateunix(d$)
wlog "date$:    " + d$

d$ = unixdate$(d)
wlog "Europe:   " + d$

d$ = unixdate$(d, 1)
wlog "American: " + d$

d$ = unixdate$(d, 2)
wlog "Canadian: " + d$



cicciocb

unread,
Nov 28, 2020, 6:27:37 AM11/28/20
to Annex WiFi RDS
No, the date is correct on ESP8266 1.42.4

Fernando Perez

unread,
Nov 28, 2020, 7:45:45 AM11/28/20
to Annex WiFi RDS
As always, thanks cicciocb.
It happens to me on a Wemos D1 mini, with Annex 1.42.4. Could it be because of my time zone in config?
CET-1CEST,M3.5.0,M10.5.0/3
 
I was going crazy with a program that I am writing, because it always synchronized when I turned on the Wemos.
I have solved it by simply adding 1 a day. But I'm curious if it happens to someone else.
 
dead = 0

i2c.setup 4, 5

if (rtc.time$ <> time$) OR (rtc.date$ <> date$) then Sincro

while NOT dead
  wlog "RTC:" + RTC.TIME$ + " " + RTC.DATE$
  wlog "NTP:" + time$ + " " + date$
  pause 10000
  wlog
wend

SUB Sincro
dim f(5)
LOCAL f$, i, j

f$ = replace$(unixdate$(dateunix(date$),2),"/","")
f$ = f$ + replace$(unixtime$(timeunix(time$)),":","")

for i = 0 to 5
  j = (i*2) + 1 
  f(i) = val(mid$(f$, j, 2))
next i 

' RTC.SETTIME Year, Month, Day, Hours, Minutes, Seconds
RTC.SETTIME f(0), f(1), f(2)+1, f(3), f(4), f(5)
wlog "Date and time synchronized by NTP"

END SUB


 

ciccio cb

unread,
Nov 28, 2020, 8:35:22 AM11/28/20
to Fernando Perez, Annex WiFi RDS
Yes, maybe the cause is the time zone

--
You received this message because you are subscribed to the Google Groups "Annex WiFi RDS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to annex_wifi_rd...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/annex_wifi_rds/d162f117-49f6-4c36-9cb3-ac3bf9d92db6o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages