Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using getFormattedTime() to format a given time #30

Closed
sheffieldnikki opened this issue Apr 24, 2017 · 2 comments · May be fixed by #94 or #207
Closed

Using getFormattedTime() to format a given time #30

sheffieldnikki opened this issue Apr 24, 2017 · 2 comments · May be fixed by #94 or #207
Assignees
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@sheffieldnikki
Copy link
Contributor

sheffieldnikki commented Apr 24, 2017

I've adjusted getFormattedTime() to take an (optional) 'secs' argument, so that the same formatting code can be used to format any given time, while still formatting the NTP time if the argument is left out. This is similar to time conversion functions in other languages, and might avoid the need to include a dedicated time/date library in some projects.

NTPClient.h:

/**
 * @return secs argument (or 0 for current time) formatted like `hh:mm:ss`
 */
String getFormattedTime(unsigned long secs = 0);

NTPClient.cpp:

String NTPClient::getFormattedTime(unsigned long secs) {
  unsigned long rawTime = secs ? secs : this->getEpochTime();
@seikobu
Copy link

seikobu commented Feb 28, 2021

This is great! I was suprised to realize that this simple function wasn't pulled so far?
I'm using the frok from @taranais now! kudos

@per1234
Copy link
Contributor

per1234 commented Jun 23, 2024

Hi @sheffieldnikki. Thanks for taking the time to submit an issue.

I see we have another report about this at #3.

It is best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the other.

If you end up with additional information to share, feel free to comment in the other thread.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 23, 2024
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
3 participants