Added review comments.

This commit is contained in:
isharasampath 2020-03-19 18:43:59 +05:30
parent 68658309b1
commit 708e8a7983
3 changed files with 7 additions and 5 deletions

View File

@ -153,12 +153,12 @@ DateTime NTPClient::getDateTime() const {
return dt;
}
String NTPClient::formatDateTime(const char* fmt) const {
String NTPClient::getFormattedDateTime(const char* dateTimeFormat) const {
struct tm * ts;
time_t rawTime = this->getEpochTime();
ts = localtime(&rawTime);
char buf[64];
strftime(buf, sizeof(buf), fmt, ts);
strftime(buf, sizeof(buf), dateTimeFormat, ts);
return String(buf);
}

View File

@ -85,15 +85,15 @@ class NTPClient {
int getSeconds() const;
/**
* Get date time as a astuct which contains
* Get date time as a struct which contains
* Year, Month, Date, Hours, Minutes, Seconds
*/
DateTime getDateTime() const;
/**
* Format the date time to a string with a given format (Ex: %Y/%m/%d %H:%M:%S)
* Return the date time as a String with the given format (Ex: %Y/%m/%d %H:%M:%S)
*/
String formatDateTime(const char* fmt) const;
String getFormattedDateTime(const char* dateTimeFormat) const;
/**
* Changes the time offset. Useful for changing timezones dynamically

View File

@ -21,3 +21,5 @@ getEpochTime KEYWORD2
setTimeOffset KEYWORD2
setUpdateInterval KEYWORD2
setPoolServerName KEYWORD2
getDateTime KEYWORD2
getFormattedDateTime KEYWORD2