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

missing GMT offset in LogMessageTime #707

Closed
yaojingguo opened this issue Sep 4, 2021 · 0 comments · Fixed by #727
Closed

missing GMT offset in LogMessageTime #707

yaojingguo opened this issue Sep 4, 2021 · 0 comments · Fixed by #727

Comments

@yaojingguo
Copy link

I am trying to use Custom Log Prefix Format to format log time as ISO8601 format. So I need time GMT offset. But LogMessageTime does not expose time_struct's tm_gmtoff field.

struct LogMessageTime {
  explicit LogMessageTime (const struct::tm& time_struct_,
                           const time_t& timestamp_, const int32_t& usecs_):
      time_struct(time_struct_), ts(timestamp_), usecs(usecs_) {}

  const time_t& timestamp() const { return ts; }
  const int& sec() const { return time_struct.tm_sec; }
  const int32_t& usec() const { return usecs; }
  const int& min() const { return time_struct.tm_min; }
  const int& hour() const { return time_struct.tm_hour; }
  const int& day() const { return time_struct.tm_mday; }
  const int& month() const { return time_struct.tm_mon; }
  const int& year() const { return time_struct.tm_year; }
  const int& dayOfWeek() const { return time_struct.tm_wday; }
  const int& dayInYear() const { return time_struct.tm_yday; }
  const int& dst() const { return time_struct.tm_isdst; }

  private:
    const struct::tm& time_struct;
    const time_t& ts;
    const int32_t& usecs;
};

Is it possible to add the following code to LogMessageTime?

const int& gmtoff() const { return time_struct.gmtoff; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants