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

Allow extra Clock constructors in clockToConst #59

Merged
merged 1 commit into from
Apr 26, 2019
Merged

Allow extra Clock constructors in clockToConst #59

merged 1 commit into from
Apr 26, 2019

Conversation

brandon-leapyear
Copy link
Contributor

@brandon-leapyear brandon-leapyear commented Apr 24, 2019

This is an old work account. Please reference @brandonchinn178 for all future communication


My Mac (10.14) has CLOCK_MONOTONIC_RAW defined, as evidenced by the Clock constructor:

Prelude> import System.Clock
Prelude System.Clock> :info Clock
data Clock
  = Monotonic
  | Realtime
  | ProcessCPUTime
  | ThreadCPUTime
  | MonotonicRaw

Which then errors in clockToConst if MonotonicRaw is passed. The logic for clockToConst should follow the same logic as the Clock constructor; that is, don't put the CLOCK_MONOTONIC_RAW/CLOCK_BOOTTIME/etc. within the Linux else-block, but only check the relevant C++ flags.

My Mac (10.14) has `CLOCK_MONOTONIC_RAW` defined:
```
Prelude> import System.Clock
Prelude System.Clock> :info Clock
data Clock
  = Monotonic
  | Realtime
  | ProcessCPUTime
  | ThreadCPUTime
  | MonotonicRaw
```
Which then errors in `clockToConst` if `MonotonicRaw` is passed. The logic for clockToConst should follow the same logic as the Clock constructor; that is, don't put the CLOCK_MONOTONIC_RAW/CLOCK_BOOTTIME/etc. within the Linux else-block, but only check the relevant C++ flags.
@CetinSert CetinSert merged commit d54ef36 into corsis:master Apr 26, 2019
@CetinSert
Copy link
Member

CetinSert commented Apr 30, 2019

@brandon-leapyear do I understand correctly that this means MonotonicRaw is now available on Mac and no longer Linux-specific? If yes, I will amend the documentation. Do you know since which version of Mac?


https://bugs.python.org/issue35716 - mentions CLOCK_MONOTONIC_RAW has been available since macOS 10.12.

@brandon-leapyear
Copy link
Contributor Author

brandon-leapyear commented Apr 30, 2019

This is an old work account. Please reference @brandonchinn178 for all future communication


^ I guess there it is. It's strange though; the man page says only Linux, but I've found a few other places that recognize Mac:

@llelf
Copy link

llelf commented Apr 30, 2019

They are all system-specific. MacOS has some more that are not present on GNU/Linux.
Not to mention all other BSDs.

@cartazio
Copy link

@brandon-leapyear new enough macs have it, OS X prior to (macOS 10.12) DO NOT have
clock_gettime

https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation/mac-osx#supporting-older-os-x-versions-with-your-build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants