No description
Find a file
2018-12-01 16:26:07 +03:00
doc initial commit 2018-12-01 16:21:06 +03:00
src initial commit 2018-12-01 16:21:06 +03:00
tests initial commit 2018-12-01 16:21:06 +03:00
0BSD.txt initial commit 2018-12-01 16:21:06 +03:00
README.md Update README.md 2018-12-01 16:26:07 +03:00
timespec_get.nimble initial commit 2018-12-01 16:21:06 +03:00

timespec_get

Nanosecond-percision time using timespec_get of C11

Also, it should work on C++, but I don't know which version or what requirements it would have. I tested on C++ and it worked though.

API:

type
  timespec* = tuple[sec: int64, nsec: int32]

proc timespec_get*(): timespec
# Returns timespec with seconds and nanoseconds since start of the epoch

Example:

test1.nim:

import timespec_get
import os

var a = timespec_get()
sleep 70
var b = timespec_get()
echo b.nsec - a.nsec

License

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.