# Real-time clock (RTC) tutorial

**URL:** <https://community.particle.io/t/real-time-clock-rtc-tutorial/60261>\
**Category:** Tutorials\
**Created:** [May 6, 2021, 9:40am UTC](https://community.particle.io/t/real-time-clock-rtc-tutorial/60261 "2021-05-06T09:40:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [May 6, 2021, 9:40am UTC](https://community.particle.io/t/real-time-clock-rtc-tutorial/60261/1 "2021-05-06T09:40:49Z")

</div>

Want to learn more about real-time clocks on Particle devices?

- The VBAT pin on Gen 2 devices?
- HIBERNATE mode on Gen 3 devices?
- External RTCs?
- Other methods of time synchronization?

[https://docs.particle.io/tutorials/learn-more/real-time-clocks/](https://docs.particle.io/tutorials/learn-more/real-time-clocks/)

---

<div class="post-metadata">

**Author:** ![chipmc](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/chipmc/32/15905_2.png) [@chipmc](https://community.particle.io/u/chipmc)\
**Post date:** [May 6, 2021, 4:47pm UTC](https://community.particle.io/t/real-time-clock-rtc-tutorial/60261/2 "2021-05-06T16:47:07Z")

</div>

@rickkas7 ,

Excellent tutorial, thank you for creating this.

Quick question I have been meaning to ask: Using a 3rd Gen device with the AB1805 RTC / Watchdog. In my code, does it make any difference which of these I use to get the time?

```auto
Time.now();
//or
ab1805.getRtcAsTime();

```

I know these are synced in the main loop using ab1805.loop() but it seems like there is a chance for discontinuities as the device transitions from disconnected to connected which will cause the RTC to be updated as it connects to Particle.

Thanks,

Chip

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [May 6, 2021, 4:50pm UTC](https://community.particle.io/t/real-time-clock-rtc-tutorial/60261/3 "2021-05-06T16:50:46Z")

</div>

Thanks! No matter which source you use, there could be a discontinuity, because the AB1805 is synchronized to the cloud when the cloud time is received, and the device time (Time.now) is seeded from the RTC time if the RTC time is valid at setup(), before the cloud time is received. I’d probably always use Time.now().

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/4/64635adccc35238caa19e9b553ec3e98b163d026.png) [@system](https://community.particle.io/u/system)\
**Post date:** [November 5, 2021, 4:51am UTC](https://community.particle.io/t/real-time-clock-rtc-tutorial/60261/4 "2021-11-05T04:51:23Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
