- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
// https://github.com/layerfsd/WorkPlatForm/blob/f14a8cdd2bc3772ea4bd37a0381f5f8305a0a2c2/Common/BuilDefine.h
// source file build_defs.h
#ifndef BUILD_DEFS_H
#define BUILD_DEFS_H
#define VERSION_MAJOR 1
// Example of __DATE__ string: "Jul 27 2012"
// 01234567890
#define BUILD_YEAR_CH0 (__DATE__[ 7])
#define BUILD_YEAR_CH1 (__DATE__[ 8])
#define BUILD_YEAR_CH2 (__DATE__[ 9])
#define BUILD_YEAR_CH3 (__DATE__[10])
#define BUILD_MONTH_IS_JAN (__DATE__[0] == 'J' && __DATE__[1] == 'a' && __DATE__[2] == 'n')
#define BUILD_MONTH_IS_FEB (__DATE__[0] == 'F')
#define BUILD_MONTH_IS_MAR (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'r')
#define BUILD_MONTH_IS_APR (__DATE__[0] == 'A' && __DATE__[1] == 'p')
#define BUILD_MONTH_IS_MAY (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'y')
#define BUILD_MONTH_IS_JUN (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'n')
#define BUILD_MONTH_IS_JUL (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'l')
#define BUILD_MONTH_IS_AUG (__DATE__[0] == 'A' && __DATE__[1] == 'u')
#define BUILD_MONTH_IS_SEP (__DATE__[0] == 'S')
#define BUILD_MONTH_IS_OCT (__DATE__[0] == 'O')
#define BUILD_MONTH_IS_NOV (__DATE__[0] == 'N')
#define BUILD_MONTH_IS_DEC (__DATE__[0] == 'D')
#define BUILD_MONTH_CH0 \
((BUILD_MONTH_IS_OCT || BUILD_MONTH_IS_NOV || BUILD_MONTH_IS_DEC) ? '1' : '0')
#define BUILD_MONTH_CH1 \
( \
(BUILD_MONTH_IS_JAN) ? '1' : \
(BUILD_MONTH_IS_FEB) ? '2' : \
(BUILD_MONTH_IS_MAR) ? '3' : \
(BUILD_MONTH_IS_APR) ? '4' : \
(BUILD_MONTH_IS_MAY) ? '5' : \
(BUILD_MONTH_IS_JUN) ? '6' : \
(BUILD_MONTH_IS_JUL) ? '7' : \
(BUILD_MONTH_IS_AUG) ? '8' : \
(BUILD_MONTH_IS_SEP) ? '9' : \
(BUILD_MONTH_IS_OCT) ? '0' : \
(BUILD_MONTH_IS_NOV) ? '1' : \
(BUILD_MONTH_IS_DEC) ? '2' : \
/* error default */ '?' \
)
#define BUILD_DAY_CH0 ((__DATE__[4] >= '0') ? (__DATE__[4]) : '0')
#define BUILD_DAY_CH1 (__DATE__[ 5])
#define BUILD_HOUR_CH0 (__TIME__[0])
#define BUILD_HOUR_CH1 (__TIME__[1])
#define BUILD_MIN_CH0 (__TIME__[3])
#define BUILD_MIN_CH1 (__TIME__[4])
#define BUILD_SEC_CH0 (__TIME__[6])
#define BUILD_SEC_CH1 (__TIME__[7])
#if VERSION_MAJOR > 100
#define VERSION_MAJOR_INIT \
((VERSION_MAJOR / 100) + '0'), \
(((VERSION_MAJOR % 100) / 10) + '0'), \
((VERSION_MAJOR % 10) + '0')
#elif VERSION_MAJOR > 10
#define VERSION_MAJOR_INIT \
((VERSION_MAJOR / 10) + '0'), \
((VERSION_MAJOR % 10) + '0')
#else
#define VERSION_MAJOR_INIT \
(VERSION_MAJOR + '0')
#endif
#endif // BUILD_DEFS_H
j123123 03.09.2021 02:16 # 0
А в крестоговне можно без макросов, в constexpr-функцию скармливать __DATE__ и там ее парсить.
guest6 03.09.2021 02:22 # +2
А нельзя как-то посчитать системой сборки и передать?
j123123 03.09.2021 03:37 # +2
guest6 03.09.2021 14:01 # 0
Можете заставить крестошаблонщиков плакать от зависти?
guest6 03.09.2021 11:26 # 0
Soul_re@ver 03.09.2021 12:20 # +1
CHayT 03.09.2021 13:22 # +2
JloJle4Ka 03.09.2021 13:38 # 0
CHayT 03.09.2021 13:41 # +2
Desktop 03.09.2021 14:04 # 0
Формат всегда одинаковый?
Steve_Brown 03.09.2021 15:14 # +1
The following macro names shall be defined by the implementation:
__DATE__ The date of translation of the preprocessing translation unit: a character string literal of the form "Mmm dd yyyy", where the names of the months are the same as those generated by the asctime function, and the first character of dd is a space character if the value is less than 10. If the date of translation is not available, an implementation-defined valid date shall be supplied.
---
The asctime function converts the broken-down time in the structure pointed to by timeptr into a string in the form using the equivalent of the following algorithm.
Steve_Brown 03.09.2021 14:05 # +2
guest6 03.09.2021 15:13 # +1
https://babbage.cs.qc.cuny.edu/courses/cs701/Handouts/rcs_keywords.html
Во времена CVS было очень часто
CEHT9I6PbCKuu_nemyx 03.09.2021 15:24 # 0