I wonder if the following sample code can be some help?
P.S. In RTC.h there are functions, like
uint64 RTC_ConstructUnixAlarmTime(const RTC_DATE_TIME* alarmTime, uint8 alarmCfgMask);
uint64 RTC_GetDstUnixTime(const RTC_DST_TIME* dstTime);
Thanks for the reply. Unfortunately that's more dealing with converting time from "standard" format to BCD, so it can be stored in the RTC. I've managed to get that conversion working so I can write and read from my RTC.
I'm reading the local time off a Current Time Service (my iPhone), but want to store it in the RTC as UTC time.
Seems simple enough to add/delete the time zone and DST offsets, but of course if (as is my case here in Australia) your local time is on the next day compared to UTC when you do the time read/conversion, you potentially need to make adjustments to day of the week, day of the month, month and year! I was hoping someone had done the hard work of writing a suitable function to achieve this already 🙂
I'm just curious, but have you taken a look at my mcu_time.c?
I though that I tried the "hard work" in ts2time() and ts2tm().
My apologies - I didn't see your second post. Had a quick look over those two functions, and I think ts2time() may have given me a few ideas on how to make my Convert2UTC() function a bit neater!