Menu

Logging UTC time

Daniel
2014-04-11
2021-06-24
  • Daniel

    Daniel - 2014-04-11

    Hello,

    Using the attribute:

    BOOST_LOG_ATTRIBUTE_KEYWORD(timestamp, "TimeStamp", boost::posix_time::ptime)

    is logging the local time.

    What should I do to log the UTC time ?

    Many thanks,
    Daniel

     
  • Andrey Semashev

    Andrey Semashev - 2014-04-11

    That is just a keyword which is used to refer to attribute values, it does not define an attribute. There are two attributes you can use to generate timestamps: local_clock and utc_clock. If you add the latter, you get UTC time readings.

     

    Last edit: Andrey Semashev 2021-06-24
  • Dav

    Dav - 2021-06-24

    Hello, can you provide an example?

     
  • Andrey Semashev

    Andrey Semashev - 2021-06-24

    The example is given in the linked page, just replace attrs::local_clock with attrs::utc_clock.

     

Log in to post a comment.