Skip to content

AM/PM handling with 12-hour RTC setting? #3944

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

Closed
damellis opened this issue Oct 9, 2015 · 10 comments
Closed

AM/PM handling with 12-hour RTC setting? #3944

damellis opened this issue Oct 9, 2015 · 10 comments
Assignees
Labels
Architecture: SAMD Applies only to the SAMD microcontrollers (Zero, etc.) Library: Other Arduino libraries that don't have their own label
Milestone

Comments

@damellis
Copy link
Contributor

damellis commented Oct 9, 2015

If you put the RTC library in 12-hour mode, how does it handle AM and PM? Is there any way to specify whether or not an hour is AM or PM? Or tell, when you get the time, whether it's AM or PM? If not, should we just eliminate 12-hour mode?

@damellis damellis added Library: Other Arduino libraries that don't have their own label Architecture: SAM Applies only to the SAM microcontrollers (Due) labels Oct 9, 2015
@shiftleftplusone
Copy link

maybe poll the time in 24 hour fmt intermediately?
char * timefmt= (hour24 != hour12 ? "PM" : "AM") ;

but IMO it's easier to always set to 24 hour fmt and then transform to PM if hour>12 in case that would be wishful for which reason ever....

or what is the problem?

@agdl
Copy link
Member

agdl commented Oct 19, 2015

@damellis you are right, at the moment, we have no method to understand the time representation, however it ca be simply implemented pollig the control bit RTC_MODE2_CTRL_CLKREP in RTC->MODE2.CTRL.reg (that you set with the rtc.begin(bool timeRep). I also wnt to add methods that returns to you a string for time and date. What do you think about these improvements?

@damellis
Copy link
Contributor Author

I think you could start by just dropping 12 hour support, and letting the
user's sketch do the translation from 24 hour to 12 hour time if they want
to print it that way. If we do add date formatting code, it would be good
to include 12 hour options there, but that also feels like an extension
that isn't necessarily a solution to this particular issue.

On Mon, Oct 19, 2015 at 12:38 AM, Arturo Guadalupi <[email protected]

wrote:

@damellis https://github.com/damellis you are right, at the moment, we
have no method to understand the time representation, however it ca be
simply implemented pollig the control bit RTC_MODE2_CTRL_CLKREPin
RTC->MODE2.CTRL.reg (that you set with the rtc.begin(bool timeRep). I also
wnt to add methods that returns to you a string for time and date. What do
you think about these improvements?


Reply to this email directly or view it on GitHub
#3944 (comment).

@agdl
Copy link
Member

agdl commented Oct 21, 2015

@damellis @vogonjeltz I removed the 12 hour support as you suggested. It can be implemented in the sketch with no so may effort

arduino-libraries/RTCZero@c7d65d2

@agdl agdl added the Waiting for feedback More information must be provided before we can proceed label Oct 23, 2015
@agdl
Copy link
Member

agdl commented Oct 28, 2015

I'm closing this. Reopen it if there are further requests please

@agdl agdl closed this as completed Oct 28, 2015
@ffissore ffissore modified the milestone: Release 1.6.6 Oct 28, 2015
@agdl
Copy link
Member

agdl commented Nov 17, 2015

We have this PR:
arduino-libraries/RTCZero#3
What do you think about it?

@agdl agdl reopened this Nov 17, 2015
@agdl agdl modified the milestones: Release 1.6.7, Release 1.6.6 Nov 17, 2015
@agdl
Copy link
Member

agdl commented Nov 17, 2015

Adding @cmaglie and @facchinm to the loop

@agdl agdl added Architecture: SAMD Applies only to the SAMD microcontrollers (Zero, etc.) and removed Architecture: SAM Applies only to the SAM microcontrollers (Due) labels Nov 17, 2015
@damellis
Copy link
Contributor Author

Personally, I don't really see the value of 12 hour time. It just seems
more complicated to call one function to get the hours and another function
to get AM vs. PM, when you could just get one number from 0 to 23. Are
there people that are asking for 12 hour functions? What's the use case?

On Tue, Nov 17, 2015 at 8:28 AM, Arturo Guadalupi [email protected]
wrote:

Adding @cmaglie https://github.com/cmaglie and @facchinm
https://github.com/facchinm to the loop


Reply to this email directly or view it on GitHub
#3944 (comment).

@agdl
Copy link
Member

agdl commented Nov 18, 2015

@damellis ok i asked also to Gabriel his opinion, and he agreed to remove it. So I'm closing this again!

@agdl agdl closed this as completed Nov 18, 2015
@cmaglie cmaglie removed the Waiting for feedback More information must be provided before we can proceed label Oct 18, 2016
@ShoneVj
Copy link

ShoneVj commented Jul 5, 2017

i think its better to setDS1307 in 24 hr mode and later convert it to 12 hr .Bcoz if we config it in 12 hr mode it is not possible to read whether it is am or pm.. im not pretty sure about this any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: SAMD Applies only to the SAMD microcontrollers (Zero, etc.) Library: Other Arduino libraries that don't have their own label
Projects
None yet
Development

No branches or pull requests

6 participants