[libc][timezone] implement lightweith timezone configuration

This commit is contained in:
Meco Man
2023-08-13 22:51:58 -04:00
parent a6959a9ef8
commit 432c2f38fc
4 changed files with 101 additions and 54 deletions
@@ -28,19 +28,8 @@ extern "C" {
#define CLOCKS_PER_SEC RT_TICK_PER_SECOND
/* timezone */
/* this method of representing timezones has been abandoned */
#define DST_NONE 0 /* not on dst */
#define DST_USA 1 /* USA style dst */
#define DST_AUST 2 /* Australian style dst */
#define DST_WET 3 /* Western European dst */
#define DST_MET 4 /* Middle European dst */
#define DST_EET 5 /* Eastern European dst */
#define DST_CAN 6 /* Canada */
#define DST_GB 7 /* Great Britain and Eire */
#define DST_RUM 8 /* Rumania */
#define DST_TUR 9 /* Turkey */
#define DST_AUSTALT 10 /* Australian style with shift in 1986 */
struct itimerspec;
struct timezone
{
@@ -48,6 +37,15 @@ struct timezone
int tz_dsttime; /* type of dst correction */
};
/* lightweight timezone and daylight saving time */
#ifdef RT_LIBC_USING_LIGHT_TZ_DST
void rt_tz_set(int32_t offset_sec);
int32_t rt_tz_get(void);
int8_t rt_tz_is_dst(void);
#endif /* RT_LIBC_USING_LIGHT_TZ_DST */
struct itimerspec;
#if defined(_GNU_SOURCE) && (defined(__x86_64__) || defined(__i386__))
/* linux x86 platform gcc use! */
#define _TIMEVAL_DEFINED
@@ -218,11 +216,6 @@ int timer_gettime(timer_t timerid, struct itimerspec *its);
int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
#endif /* RT_USING_POSIX_TIMER */
/* timezone */
void tz_set(int8_t tz);
int8_t tz_get(void);
int8_t tz_is_dst(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */