user55411: I am using a DS3231 RTC module. It requires to set the time every time it is reset. I was wondering if I could read my MacBook's time and date and feed into the module at the setup stage. Is this possible?
P.S. I do not have to use a battery.

user4900: You can use __DATE__ and __TIME__ compiler time constants in IDE and do check inside of your setup() function if the RTC clock is zeroed then parse and set compile time values.
char cr[] = __DATE__;
char ct[] = __TIME__;

At the compile time these macros will be replaced with text constants "Apr  4 2019" and "10:35:22" respectively.

55411: <p>I am using a DS3231 RTC module. It requires to set the time every time it is reset. I was wondering if I could read my MacBook's time and date and feed into the module at the setup stage. Is this possible?</p>

<p>P.S. I do not have to use a battery.</p>
 4900: <p>You can use <code>__DATE__</code> and <code>__TIME__</code> compiler time constants in IDE and do check inside of your <code>setup()</code> function if the RTC clock is zeroed then parse and set compile time values.</p>

<pre><code>char cr[] = __DATE__;
char ct[] = __TIME__;
</code></pre>

<p>At the compile time these macros will be replaced with text constants <code>"Apr  4 2019"</code> and <code>"10:35:22"</code> respectively.</p>
