Skip to content

[vconone] Notice people to update year #14592

@dayo09

Description

@dayo09

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.

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(&current_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions