authorgravatar for tgschultz@gmail.comtgschultz <tgschultz@gmail.com> 2018-04-18 17:43:35-05:00
committergravatar for tgschultz@gmail.comtgschultz <tgschultz@gmail.com> 2018-04-18 17:43:35-05:00
log7cfe328a16ef0d1436d8eb37980d6ebf6908a0d8
tree94043146d9fcf4a56d00c8ac83119651c34c6195
parentbf9cf28322bf19aef72cbc5876e2ca083f762d7c

fixed typos.


2 files changed, 11 insertions(+), 11 deletions(-)

std/os/linux/index.zig+1-1
......@@ -511,7 +511,7 @@ pub fn gettimeofday(tv: &timeval, tz: &timezone) usize {
511511 return syscall2(SYS_gettimeofday, @ptrToInt(tv), @ptrToInt(tz));
512512}
513513
514pub fn settimeofdat(tv: &const timeval, tz: &const timezone) usize {
514pub fn settimeofday(tv: &const timeval, tz: &const timezone) usize {
515515 return syscall2(SYS_settimeofday, @ptrToInt(tv), @ptrToInt(tz));
516516}
517517
std/os/time.zig+10-10
......@@ -52,18 +52,18 @@ pub fn posixSleep(seconds: u63, nanoseconds: u63) void {
5252
5353/// Get the posix timestamp, UTC, in seconds
5454pub fn timestamp() u64 {
55 return @divFloor(miliTimestamp(), ms_per_s);
55 return @divFloor(milliTimestamp(), ms_per_s);
5656}
5757
5858/// Get the posix timestamp, UTC, in nanoseconds
59pub const miliTimestamp = switch(builtin.os) {
60 Os.windows => miliTimestampWindows,
61 Os.linux => miliTimestampPosix,
62 Os.macosx, Os.ios => miliTimestampDarwin,
59pub const milliTimestamp = switch(builtin.os) {
60 Os.windows => milliTimestampWindows,
61 Os.linux => milliTimestampPosix,
62 Os.macosx, Os.ios => milliTimestampDarwin,
6363 else => @compileError("Unsupported OS"),
6464};
6565
66fn miliTimestampWindows() u64 {
66fn milliTimestampWindows() u64 {
6767 //FileTime has a granularity of 100 nanoseconds
6868 // and uses the NTFS/Windows epoch
6969 var ft: i64 = undefined;
......@@ -73,7 +73,7 @@ fn miliTimestampWindows() u64 {
7373 return u64(@divFloor(ft, hns_per_ms) + epoch_adj);
7474}
7575
76fn miliTimestampDarwin() u64 {
76fn milliTimestampDarwin() u64 {
7777 //Sources suggest MacOS 10.12 has support for
7878 // posix clock_gettime.
7979 var tv: darwin.timeval = undefined;
......@@ -84,7 +84,7 @@ fn miliTimestampDarwin() u64 {
8484 return u64(sec_ms) + u64(usec_ms);
8585}
8686
87fn miliTimestampPosix() u64 {
87fn milliTimestampPosix() u64 {
8888 //From what I can tell there's no reason clock_gettime
8989 // should ever fail for us with CLOCK_REALTIME
9090 var ts: posix.timespec = undefined;
......@@ -238,9 +238,9 @@ test "os.time.timestamp" {
238238 const ns_per_ms = (ns_per_s / ms_per_s);
239239 const margin = 50;
240240
241 const time_0 = miliTimestamp();
241 const time_0 = milliTimestamp();
242242 sleep(0, ns_per_ms);
243 const time_1 = miliTimestamp();
243 const time_1 = milliTimestamp();
244244 const interval = time_1 - time_0;
245245 debug.assert(interval > 0 and interval < margin);
246246}