[flang-commits] [PATCH] D111281: [flang] More work on SYSTEM_CLOCK runtime API and implementation

Diana Picus via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Oct 11 01:53:35 PDT 2021


rovka added inline comments.


================
Comment at: flang/runtime/time-intrinsic.cpp:78
   if (clock_gettime(CLOCKID, &tspec) == 0) {
     return tspec.tv_nsec * 1.0e-9 + tspec.tv_sec;
   }
----------------
klausler wrote:
> rovka wrote:
> > Actually I think this one needs -1 too :) 
> I don't understand.  The math seems straightforward and correct to me.
Right, this comment was supposed to be for line 125. I think Phabricator got confused because I commented from the Diff 1 vs Diff 2 view, sorry about that.


================
Comment at: flang/runtime/time-intrinsic.cpp:122
+  constexpr auto max_clock_t{std::numeric_limits<std::clock_t>::max()};
+  unsigned_count_t maxCount{GetHUGE(kind)};
+  return max_clock_t <= maxCount ? static_cast<count_t>(max_clock_t)
----------------
klausler wrote:
> rovka wrote:
> > Isn't maxCount actually GetHUGE - 1? (Since you're doing % at the end of GetSystemClockCount).
> Thanks for noticing that!
I meant here: you updated the preferred_implementation with -1, but not the fallback_implementation. They both do % GetHUGE, so they should both have -1.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111281/new/

https://reviews.llvm.org/D111281



More information about the flang-commits mailing list