Skip to content

Commit 3b19e64

Browse files
committed
[vconone] Notice people to update year
But I am not sure this can work. ONE-DCO-Signed-off-by: Dayoung Lee <[email protected]>
1 parent bce28b1 commit 3b19e64

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Diff for: compiler/vconone/src/version.test.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@
1818

1919
#include <gtest/gtest.h>
2020

21+
#include <chrono>
22+
23+
namespace
24+
{
25+
26+
int get_current_year(void)
27+
{
28+
auto now = std::chrono::system_clock::now();
29+
std::time_t current_time = std::chrono::system_clock::to_time_t(now);
30+
std::tm *timeinfo = std::localtime(&current_time);
31+
32+
int year = timeinfo->tm_year + 1900;
33+
return year;
34+
}
35+
36+
} // namespace
37+
2138
TEST(vconone, version_number)
2239
{
2340
auto v = vconone::get_number();
@@ -45,5 +62,15 @@ TEST(vconone, copyright)
4562
{
4663
auto str = vconone::get_copyright();
4764

65+
int year = 2024;
66+
67+
if (year < get_current_year())
68+
{
69+
std::cout << "!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!\r\n";
70+
std::cout << "\tPlease update vconone year.\r\n";
71+
std::cout << "\tIt seems it's a new year and vconcone is not updated.\r\n";
72+
std::cout << "\tHappy new year!\r\n";
73+
}
74+
4875
ASSERT_NE("", str);
4976
}

0 commit comments

Comments
 (0)