Soldered SD Card Arduino Library 1.0.0
Easily read and write files to and form the SD card breakout! A fork of the original SDFat library by Bill Greiman.
Loading...
Searching...
No Matches
CompileDateTime.h
Go to the documentation of this file.
1
25#ifndef CompileDateTime_h
26#define CompileDateTime_h
27// Note - these functions will compile to a few bytes
28// since they are evaluated at compile time.
29
31constexpr uint16_t compileYear()
32{
33 return 1000 * (__DATE__[7] - '0') + 100 * (__DATE__[8] - '0') + 10 * (__DATE__[9] - '0') + (__DATE__[10] - '0');
34}
36constexpr bool compileMonthIs(const char *str)
37{
38 return __DATE__[0] == str[0] && __DATE__[1] == str[1] && __DATE__[2] == str[2];
39}
41constexpr uint8_t compileMonth()
42{
43 return compileMonthIs("Jan") ? 1
44 : compileMonthIs("Feb") ? 2
45 : compileMonthIs("Mar") ? 3
46 : compileMonthIs("Apr") ? 4
47 : compileMonthIs("May") ? 5
48 : compileMonthIs("Jun") ? 6
49 : compileMonthIs("Jul") ? 7
50 : compileMonthIs("Aug") ? 8
51 : compileMonthIs("Sep") ? 9
52 : compileMonthIs("Oct") ? 10
53 : compileMonthIs("Nov") ? 11
54 : compileMonthIs("Dec") ? 12
55 : 0;
56}
58constexpr uint8_t compileDay()
59{
60 return 10 * (__DATE__[4] == ' ' ? 0 : __DATE__[4] - '0') + (__DATE__[5] - '0');
61}
63constexpr uint8_t compileHour()
64{
65 return 10 * (__TIME__[0] - '0') + __TIME__[1] - '0';
66}
68constexpr uint8_t compileMinute()
69{
70 return 10 * (__TIME__[3] - '0') + __TIME__[4] - '0';
71}
73constexpr uint8_t compileSecond()
74{
75 return 10 * (__TIME__[6] - '0') + __TIME__[7] - '0';
76}
77#endif // CompileDateTime_h
constexpr uint8_t compileDay()
Definition CompileDateTime.h:58
constexpr uint8_t compileSecond()
Definition CompileDateTime.h:73
constexpr uint16_t compileYear()
Definition CompileDateTime.h:31
constexpr uint8_t compileMonth()
Definition CompileDateTime.h:41
constexpr uint8_t compileHour()
Definition CompileDateTime.h:63
constexpr bool compileMonthIs(const char *str)
Definition CompileDateTime.h:36
constexpr uint8_t compileMinute()
Definition CompileDateTime.h:68