-
Notifications
You must be signed in to change notification settings - Fork 178
Open
Description
What?
vconone is a library that helps printing out version information with copyright.
It's copyright year should be manually updated.
However, it's very hard to notice this job.
- [vconone] Update copyright year #14587 from 2023 to 2025: Updated 1 year later
- [vconone] Update copyright year #11322 from 2022 to 2023: Updated 8 months later
Therefore, I suggest comparing vconone year and system clock's year in unittest.
int get_current_year(void)
{
auto now = std::chrono::system_clock::now();
std::time_t current_time = std::chrono::system_clock::to_time_t(now);
std::tm *timeinfo = std::localtime(¤t_time);
int year = timeinfo->tm_year + 1900;
return year;
}- pros
- We can precisely give out our copyright information.
- cons
- Unit test can result in failure (false-negative) if the machine's system clock is wrong.
- On the first day of the year, we may confront CI failure without noticing.
- Maybe we can make give it a term for 1 month or so. (ex. Fail the test if it's not fixed until Feb of the next year)
DRAFT: #14588
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels