diff options
author | Alistair Popple <alistair@popple.id.au> | 2014-08-15 14:31:22 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-08-15 14:36:38 +1000 |
commit | aa3a45f47b0e85f453a5c2d1414bba668328737e (patch) | |
tree | bac0e10afcbc43c58fedd44ca1af77a953d65971 /include | |
parent | 0890debca7cdd9a78ca2d6d52e07609404412818 (diff) | |
download | skiboot-aa3a45f47b0e85f453a5c2d1414bba668328737e.zip skiboot-aa3a45f47b0e85f453a5c2d1414bba668328737e.tar.gz skiboot-aa3a45f47b0e85f453a5c2d1414bba668328737e.tar.bz2 |
fsp/rtc: Use libc time functions
Our libc now has a proper implementation of mktime, which makes adding
tm structures together easy. This patch makes the FSP RTC functions
use the library functions and removes the generic time calculation
code from the FSP RTC driver.
The OPAL<->tm conversion functions are also made public as they will
be useful for the IPMI RTC implementation.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/time-utils.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/time-utils.h b/include/time-utils.h new file mode 100644 index 0000000..721b6f7 --- /dev/null +++ b/include/time-utils.h @@ -0,0 +1,26 @@ +/* Copyright 2013-2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __TIME_UTILS_H +#define __TIME_UTILS_H + +#include <stdint.h> +#include <time.h> + +void tm_to_datetime(struct tm *tm, uint32_t *y_m_d, uint64_t *h_m_s_m); +void datetime_to_tm(uint32_t y_m_d, uint64_t h_m_s_m, struct tm *tm); + +#endif |