Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug when ENABLE_STAMP_WITH_LOCAL set ON #31

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/rs_driver/driver/decoder/basic_attr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ inline uint64_t parseTimeYMD(const RSTimestampYMD* tsYmd)
stm.tm_hour = tsYmd->hour;
stm.tm_min = tsYmd->minute;
stm.tm_sec = tsYmd->second;
time_t sec = std::mktime(&stm);
time_t sec =
#if defined(_WIN32)
_mkgmtime(&stm);
#else
timegm(&stm)
#endif
;

uint64_t ms = ntohs(tsYmd->ms);
uint64_t us = ntohs(tsYmd->us);
Expand Down Expand Up @@ -194,7 +200,7 @@ inline void createTimeYMD(uint64_t usec, RSTimestampYMD* tsYmd)

time_t t_sec = sec;

std::tm* stm = localtime(&t_sec);
std::tm* stm = gmtime(&t_sec);

#if 0
std::cout << "+ tm_year:" << stm->tm_year
Expand Down