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

Added getFormattedDateTime method #207

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

leodrivera
Copy link

@leodrivera leodrivera commented May 9, 2024

Implement getFormattedDateTime, which has the advantage, when compared #94 that does not rely on external lib and parse more patterns. The #161 was used as base, however, I had to change all the calculation logic, as the results were not correct

Patterns

  %Y: Full year (e.g., 2023)
  %y: Last two digits of the year (e.g., 23 for 2023)
  %m: Month as a zero-padded decimal number (01 to 12)
  %d: Day of the month as a zero-padded decimal number (01 to 31)
  %H: Hour (00 to 23) as a zero-padded decimal number
  %M: Minute as a zero-padded decimal number (00 to 59)
  %S: Second as a zero-padded decimal number (00 to 59)
  %a: Abbreviated weekday name according to the current locale
  %A: Full weekday name according to the current locale
  %w: Weekday as a decimal number (0 for Sunday through 6 for Saturday)
  %b: Abbreviated month name according to the current locale
  %B: Full month name according to the current locale
  %p: "AM" or "PM" based on the hour (Note: This is locale-sensitive and might not be applicable in all languages)

With this new method, getFormattedTime loses the meaning of existing, given that we can obtain the same result through the parameter "%H:%M:%S"

timeClient.getFormattedDateTime("%H:%M:%S")

@CLAassistant
Copy link

CLAassistant commented May 9, 2024

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels May 9, 2024
@leodrivera leodrivera force-pushed the feat/getFormattedDateTime branch from 4c44ac0 to 3b359eb Compare May 10, 2024 03:51
Copy link

Memory usage change @ 3b359eb

Board flash % RAM for global variables %
esp8266:esp8266:huzzah N/A N/A N/A N/A
Click for full report table
Board examples/Advanced
flash
% examples/Advanced
RAM for global variables
% examples/Basic
flash
% examples/Basic
RAM for global variables
% examples/FormattedDateTime
flash
% examples/FormattedDateTime
RAM for global variables
% examples/IsTimeSet
flash
% examples/IsTimeSet
RAM for global variables
%
esp8266:esp8266:huzzah N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/Advanced<br>flash,%,examples/Advanced<br>RAM for global variables,%,examples/Basic<br>flash,%,examples/Basic<br>RAM for global variables,%,examples/FormattedDateTime<br>flash,%,examples/FormattedDateTime<br>RAM for global variables,%,examples/IsTimeSet<br>flash,%,examples/IsTimeSet<br>RAM for global variables,%
esp8266:esp8266:huzzah,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

@leodrivera leodrivera force-pushed the feat/getFormattedDateTime branch from a71b16c to 5b5c317 Compare May 23, 2024 04:36
Copy link

Memory usage change @ 5b5c317

Board flash % RAM for global variables %
esp8266:esp8266:huzzah N/A N/A N/A N/A
Click for full report table
Board examples/Advanced
flash
% examples/Advanced
RAM for global variables
% examples/Basic
flash
% examples/Basic
RAM for global variables
% examples/FormattedDateTime
flash
% examples/FormattedDateTime
RAM for global variables
% examples/IsTimeSet
flash
% examples/IsTimeSet
RAM for global variables
%
esp8266:esp8266:huzzah N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/Advanced<br>flash,%,examples/Advanced<br>RAM for global variables,%,examples/Basic<br>flash,%,examples/Basic<br>RAM for global variables,%,examples/FormattedDateTime<br>flash,%,examples/FormattedDateTime<br>RAM for global variables,%,examples/IsTimeSet<br>flash,%,examples/IsTimeSet<br>RAM for global variables,%
esp8266:esp8266:huzzah,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

@nricciardi

This comment was marked as duplicate.

@arduino-libraries arduino-libraries locked as too heated and limited conversation to collaborators Nov 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
4 participants