It looks like I was overcomplicating this.  The constructor for a
std::chrono::time_point does take in a duration from the clock's
epoch, which is ultimately what we want to do.

PR up on github for review.

-Robert Middleton

On Sat, Nov 26, 2022 at 11:10 PM Stephen Webb <swebb2...@gmail.com> wrote:
>
> Fmt seems to have a formatter for std::chrono::time_point templated by
> std::chrono::system_clock and (optionally) std::chrono::utc_clock if my
> interpretation of the fmt/chrono.h code in the https://github.com/fmtlib
> master branch is correct.
>
> Quoting from https://en.cppreference.com/w/cpp/chrono/high_resolution_clock
> >
> > It may be an alias of std::chrono::system_clock
> > <https://en.cppreference.com/w/cpp/chrono/system_clock> or
> > std::chrono::steady_clock
> > <https://en.cppreference.com/w/cpp/chrono/steady_clock>, or a third,
> > independent clock.
>
>
> On Sun, Nov 27, 2022 at 2:14 AM Robert Middleton <rmiddle...@apache.org>
> wrote:
>
> > Odd.  How would we format the timestamp in that case?  According to
> > the documentation, fmt has formatters for std::chrono::time_point
> > already.
> >
> > Is this some sort of difference between MSVC and gcc?  It should be
> > trying to format
> > std::chrono::time_point<std::chrono::high_resolution_clock>, which I
> > thought was std::chrono::system_clock instead of steady_clock.
> >
> > -Robert Middleton
> >
> >
> > On Fri, Nov 25, 2022 at 11:03 PM Stephen Webb <swebb2...@gmail.com> wrote:
> > >
> > >  In Visual studio 2019 the line
> > >
> > > fmt::arg("d", event->getChronoTimeStamp()),
> > >
> > >
> > > causes the compile time error:
> > >
> > > error C2338: Cannot format an argument. To make type T formattable
> > provide
> > > a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
> > >
> > >
> > > It seems to need a formatter  specialization for
> > > std::chrono::steady_clock::time_point.
> > >
> > > The branch build OK with the above line commented out.
> > >
> > > On Sat, Nov 26, 2022 at 2:13 AM Robert Middleton <rmiddle...@apache.org>
> > > wrote:
> > >
> > > > I've been working on LOGCXX-514(using fmt as an alternative layout to
> > > > the PatternLayout) and I've got a working implementation on Linux.
> > > > However, the Windows build currently fails with some sort of symbol or
> > > > linking error.  Since I'm not all that familiar with Windows, would
> > > > somebody with more experience on the Windows side be able to take a
> > > > look at it?
> > > >
> > > > I suspect that this could also be something to do with the wchar on
> > > > Windows, but it is not clear to me if that is the case or not.
> > > >
> > > > -Robert Middleton
> > > >
> >

Reply via email to