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

Fix rtc api time conversion #4499

Merged
merged 6 commits into from
Jun 8, 2017
Merged

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented Jun 8, 2017

Remove usage of mktime and localtime from RTC drivers. This PR was taken from #4479 and expanded to cover all the targets since they have the same issue as ST devices. @pan- feel free to modify this as necessary.

c1728p9 and others added 2 commits June 7, 2017 22:03
The Ameba RTC driver converts time_t to
second/minute/hour/day/month/year in rtc_write and back to time_t in
rtc_read. Replace this with an implementation which uses time_t
directly.
The use of mktime was causing a fault when called in interrupt handler because on GCC it lock the mutex protecting the environment, To overcome this issue, this patch add dedicated routine to convert a time_t into a tm and vice versa.
In the process mktime has been optimized and is now an order of magnitude faster than the routines present in the C library.
@sg-
Copy link
Contributor

sg- commented Jun 8, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented Jun 8, 2017

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 486

Build failed!

@sg-
Copy link
Contributor

sg- commented Jun 8, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented Jun 8, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 488

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 8, 2017

retest uvisor

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 8, 2017

@mazimkhan Can you help to restart uvisor for this patch (or might listen to my command few minutes later?)

pan- added 3 commits June 8, 2017 10:01
This field is necessary, it is used by several vendor RTC: Atmel, ST, NUVOTON,
NXP.
This field is needed by the LPC43XX targets.
@pan-
Copy link
Member

pan- commented Jun 8, 2017

@c1728p9 Thanks for reusing #4479 for other RTC peripherals. I've updated the documentation so it conform with doxygen requirements. I've added localtime wday support, somehow it disappear during backport of the previous PR. I've also added localtime yday support, it is needed by LPC43XX targets.

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 8, 2017

/morph test

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 8, 2017

travis restarted, time limit reached (seeing it for the first time...)

@mbed-bot
Copy link

mbed-bot commented Jun 8, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 496

All builds and test passed!

@sg- sg- merged commit 434787b into ARMmbed:master Jun 8, 2017
@jeromecoutant
Copy link
Collaborator

Hi
If someone has some time, please correct the warning :-)

[Warning] mbed_mktime.c@108,0: #68-D: integer conversion resulted in a change of sign
[Warning] mbed_rtc_time.cpp@56,0: #68-D: integer conversion resulted in a change of sign

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 19, 2017

@jeromecoutant Please create a separate issue the next time, would help with readability and tracking this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants