时间戳是指格林威治时间自1970年1月1日(00:00:00 GTM)至当前时间的总秒数。它也被称为Unix时间戳(Unix Timestamp);
北京时间与格林威治时间有8小时偏差,28800秒;
代码包含了时间和星期处理,年范围为2000-2099;星期计算采用基姆拉尔森计算公式;
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
typedef struct rtc_date_time
{
uint8_t u8Year; ///< Year (range 0-99)
uint8_t u8Month; ///< Month (range 1-12)
uint8_t u8Day; ///< Day (range 1-31)
uint8_t u8Hour; ///< Hours (range 1-12 when 12 hour format; range 0-23 when 24 hour format)
uint8_t u8Minute; ///< Minutes (range 0-59)
uint8_t u8Second; ///< Seconds (range 0-59)
uint8_t u8Weekday; ///< Weekday (range 0-6)
} rtc_date_time_t;
//基姆拉尔森计算公式, Kim larsen calculation formula
static uint8_t get_Weekday(uint16_t yea