Skip to content

Commit 30f8527

Browse files
authored
added TimeZone(time_t xxx, timezone);
Usage: time_t localtime; localtime = TimeZone(UnixTime, 8); // Beijing timezone = 8
1 parent a87ad87 commit 30f8527

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

STM32F1/libraries/RTClock/src/RTClock.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class RTClock {
7272
uint8_t second(time_t t) { breakTime(t, tmm); return tmm.second; }
7373
uint8_t isPM(time_t t) { return (hour(t)>=12); }
7474

75+
time_t TimeZone(time_t t, uint8_t TZ) { return ( t - (TZ * SECS_PER_HOUR)); } // usage: localtime = TimeZone(UnixTime, 8); // Beijing timezone = 8
76+
7577
void createAlarm(voidFuncPtr function, time_t alarm_time_t);
7678
void createAlarm(voidFuncPtr function, struct tm_t & alarm_tm);
7779

0 commit comments

Comments
 (0)