Skip to content

File Datetime_helper.h

FileList > firmware > Datetime_helper.h

Go to the source code of this file

Preprocessor macros to convert __DATE__ and__TIME__ macros into numeric values for the RTC.More...

Macros

Type Name
define BUILD_DAY /* multi line expression */
Extracts the day from the __DATE__ string (e.g.: "Jul 22 2024" -> 22). Handles the case where the day has a single digit (e.g.: "Jul 7 2024").
define BUILD_HOUR ((\_\_TIME\_\_[0] - '0') \* 10 + (\_\_TIME\_\_[1] - '0'))
Extracts the hour from the __TIME__ string (e.g.: "18:30:00" -> 18).
define BUILD_MIN ((\_\_TIME\_\_[3] - '0') \* 10 + (\_\_TIME\_\_[4] - '0'))
Extracts the minute from the __TIME__ string (e.g.: "18:30:00" -> 30).
define BUILD_MONTH /* multi line expression */
Converts the text month to number (e.g.: "Jan" -> 1, "Feb" -> 2, etc).
define BUILD_SEC ((\_\_TIME\_\_[6] - '0') \* 10 + (\_\_TIME\_\_[7] - '0'))
Extracts the second from the __TIME__ string (e.g.: "18:30:00" -> 00).
define BUILD_YEAR /* multi line expression */
Extracts the year from the __DATE__ string (e.g.: "Jul 22 2024" -> 2024).

Detailed Description

This file is a utility that allows setting the RTC clock time automatically to the time when the program was compiled. No modification is necessary.

Example of __DATE__: "Jul 22 2024"

Example of __TIME__: "18:30:00"

Author:

[ALD-DSL/ATARI_RESEARCH_LAB]

Date:

[2024-07-22/2025-10-15]

Version:

2.0

Copyright:

GNU General Public License version 3 or later

Macro Definition Documentation

define BUILD_DAY

Extracts the day from the __DATE__ string (e.g.: "Jul 22 2024" -> 22). Handles the case where the day has a single digit (e.g.: "Jul 7 2024").

#define BUILD_DAY `/* multi line expression */`


define BUILD_HOUR

Extracts the hour from the __TIME__ string (e.g.: "18:30:00" -> 18).

#define BUILD_HOUR `((__TIME__[0] - '0') * 10 + (__TIME__[1] - '0'))`


define BUILD_MIN

Extracts the minute from the __TIME__ string (e.g.: "18:30:00" -> 30).

#define BUILD_MIN `((__TIME__[3] - '0') * 10 + (__TIME__[4] - '0'))`


define BUILD_MONTH

Converts the text month to number (e.g.: "Jan" -> 1, "Feb" -> 2, etc).

#define BUILD_MONTH `/* multi line expression */`


define BUILD_SEC

Extracts the second from the __TIME__ string (e.g.: "18:30:00" -> 00).

#define BUILD_SEC `((__TIME__[6] - '0') * 10 + (__TIME__[7] - '0'))`


define BUILD_YEAR

Extracts the year from the __DATE__ string (e.g.: "Jul 22 2024" -> 2024).

#define BUILD_YEAR `/* multi line expression */`



The documentation for this class was generated from the following file firmware/Datetime_helper.h