NTPClient icon indicating copy to clipboard operation
NTPClient copied to clipboard

Allow selecting time format

Open Testato opened this issue 9 years ago • 4 comments

Today i needed formatted result only on HHmm, so i modified the get formatted metodhs. So if you agree it is a good idea create a new constructor whit a new argument passed for select some formatted result:

  • HHmm
  • HHmmss
  • Etc.

Testato avatar Dec 12 '15 21:12 Testato

I don't think adding time formatting to this library is a good idea. In my opinion any further time formatting should be done externally. The getFormattedTime() function is just to get you started.

FWeinb avatar May 25 '16 19:05 FWeinb

I agree with @FWeinb on this.

If it doesn't exist already, a separate date formatting/parsing Arduino library would be ideal.

sandeepmistry avatar May 27 '16 17:05 sandeepmistry

According to me I am missing: getMonth, getYear and getDay (not day of the week)

Bif1005 avatar May 30 '16 16:05 Bif1005

For general clock functions, I use the excellent https://github.com/PaulStoffregen/Time library and use NTP as a time sync provider.

#include "TimeLib.h"
time_t ntpSyncProvider() {
  return timeClient.getEpochTime();
}

then:

  setSyncProvider(&ntpSyncProvider);

That library does include an NTP example but I prefer using this NTPClient.

blackketter avatar Oct 11 '16 22:10 blackketter