Questions tagged «rtc»

4
与Unix时间戳转换
在Arduino中以毫秒为单位在日期,小时,分钟,秒之间转换为Unix时间戳的最佳方法是什么?我需要进行此转换,因为我正在使用RTC(日期,小时,分钟,秒等)并通过BLE传递Unix时间戳。 我在网上找到了一些代码片段,但尚未对其进行广泛的测试。 byte second = epoch%60; epoch /= 60; byte minute = epoch%60; epoch /= 60; byte hour = epoch%24; epoch /= 24; unsigned int years = epoch/(365*4+1)*4; epoch %= 365*4+1; unsigned int year; for (year=3; year>0; year--) { if (epoch >= days[year][0]) break; } unsigned int month; for (month=11; …
8 time  rtc  data-type 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.