Skip to content

Commit 58474fd

Browse files
committed
Revert "Fix the precision loss issue in DateTime.h. I think your test was conducted in the UTC timezone, so it was difficult for you to discover this issue. If you are in another timezone, you will notice that the hour, minute, and second data will be lost. For example, in the time judgment of intelligent charging."
This reverts commit b13a07d.
1 parent 518feb1 commit 58474fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/types/DateTime.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class DateTime
8484
m_datetime = _mkgmtime(&t);
8585
#else // _MSC_VER
8686
m_datetime = std::mktime(&t);
87+
m_datetime += t.tm_gmtoff;
8788
m_datetime -= (t.tm_isdst * 3600);
8889
#endif // _MSC_VER
8990
ret = true;
@@ -178,7 +179,7 @@ class DateTime
178179
#ifdef _MSC_VER
179180
gmtime_s(&t, &m_datetime);
180181
#else // _MSC_VER
181-
localtime_r(&m_datetime, &t);
182+
gmtime_r(&m_datetime, &t);
182183
#endif // _MSC_VER
183184
ss << std::put_time(&t, "%Y-%m-%dT%TZ");
184185
return ss.str();

0 commit comments

Comments
 (0)