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

Use higher time resolution when available in os.nim #7709

Merged
merged 1 commit into from
Jun 4, 2018

Conversation

GULPF
Copy link
Member

@GULPF GULPF commented Apr 27, 2018

This PR adds support for nanosecond resolution on posix for some procs in os.nim:

  • getLastModificationTime
  • setLastModificationTime (only microsecond resolution)
  • getLastAccessTime
  • getCreationTime
  • getFileInfo

futimens can be used to suport nanosecond resolution in setLastModificationTime, but I don't know if it's available on all of posix

Copy link
Contributor

@dom96 dom96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good apart from my one comment.

lib/pure/os.nim Outdated

# Some systems have Stat.st_*time (second resolution) instead of
# Stat.st_*tim (nanosecond resolution).
const StatHasNano = compiles(Stat.st_atim)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrm, I think you can just use declared here. If you can't, you should use the relevant define instead of compiles.

@Araq
Copy link
Member

Araq commented May 2, 2018

Please rebase so that we get accurate test results (sorry!).

lib/pure/os.nim Outdated

# Some systems have Stat.st_*time (second resolution) instead of
# Stat.st_*tim (nanosecond resolution).
const StatHasNano = not defined(macosx) and not defined(android)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better white-list the OSes that have this feature.

@Araq
Copy link
Member

Araq commented May 6, 2018

Better white-list the OSes that have this feature.

@Araq Araq merged commit 05b4473 into nim-lang:devel Jun 4, 2018
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.

3 participants