-->
Page 1 of 1

Setting sntp server in time() function

PostPosted: Sat Aug 27, 2016 12:21 pm
by Markymarc35
Hi,

Would it be possible to add a way to set the sntp server in the time function? I have a 24/7 server here that i use to sync all my other computer and i would like to be able to connect to it.

Thank you

Re: Setting sntp server in time() function

PostPosted: Sun Aug 28, 2016 11:58 am
by Mmiscool
This seems like a simple feature to ad. Let me look in to it and see what i can do.

Re: Setting sntp server in time() function

PostPosted: Sun Aug 28, 2016 6:02 pm
by Markymarc35
How's that?
In the Eval.ino file
Left pool.ntp.org hardcoded as backup :D

Code: Select allelse if ( fname == F("timesetup") && num_args > 0 ) {
    String bla;
    SaveDataToFile("TimeZone", String(args[0]));
    SaveDataToFile("DaylightSavings", String(args[1]));
    SaveDataToFile("TimeServer", String(args[2]));
    configTime(LoadDataFromFile("TimeZone").toFloat() * 3600, LoadDataFromFile("DaylightSavings").toInt(), LoadDataFromFile("TimeServer"), "pool.ntp.org");
    *value_str = "";
    return PARSER_STRING;
  }

Re: Setting sntp server in time() function

PostPosted: Wed Feb 22, 2017 2:32 am
by riban
This looks good but does not seem to be implemented in git master head. Are you planning t apply this and update documentation? Also, whilst updating docs, it would be advantageous to explain that the time is automatically set by SNTP - I searched for how to set time for a while then was perplexed when it was magically correct! (Also, a way to set time manually would be good for occasions that the device is not connected to the Internet.) Cheers