-->
Page 1 of 3

NTP client time / date command

PostPosted: Fri Nov 20, 2015 2:04 pm
by Rotohammer
I've added an ntpdate command that will fetch the current time and date from the net. Its based on https://github.com/sandeepmistry/esp826 ... Client.ino .

Now to figure out the best way to return the data into variables. I'm thinking about adding a subcommand to tell it what to return, like:

Code: Select allntpdate var fulldate 
would set var to "Wed 11 18 2015 05:32:08"

Code: Select allntpdate var dow 
would set var to "Wed"

Code: Select allntpdate var time 
would set var to " 05:32:08"

Code: Select allntpdate var secs 
would set var to "8"

I'll implement this unless someone devises a better idea.

Re: NTP client time / date command

PostPosted: Fri Nov 20, 2015 7:10 pm
by Mmiscool
This would be good to implement as a function.

Would also need a command to set the time zone.

bla = time()
bla = date()

or some thing similar.

Re: NTP client time / date command

PostPosted: Sat Nov 21, 2015 8:11 am
by Rotohammer
A function would be cool, especially for things like :

Code: Select allif date(dow) == "Sat" then ...


So I will go that route. This way theres not a lot of string ops that have to be done on the BASIC side in order to pick apart the time/date into vars.

Re: NTP client time / date command

PostPosted: Sun Nov 29, 2015 12:31 pm
by heckler
Is this "ntpdate" command working yet??
Has it been added into the latest build of BASIC?

Thanks
dwight