diff options
| author | gingerBill <bill@gingerbill.org> | 2021-01-02 16:36:51 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-01-02 16:36:51 +0000 |
| commit | 6523aefdccf4e842b7e88dbcb3d29e8d0a6f3075 (patch) | |
| tree | 9af5c88a483606b9b6411fe2b913cdb141812974 | |
| parent | 31c4a9d7703d579813cd1782584169c84b9b00a8 (diff) | |
| parent | 9fa6427a18b7504c1159e07aa1c745ecf8a88d5d (diff) | |
Merge branch 'master' of https://github.com/odin-lang/Odin
| -rw-r--r-- | core/os/os_darwin.odin | 10 | ||||
| -rw-r--r-- | core/os/os_freebsd.odin | 16 | ||||
| -rw-r--r-- | core/os/os_linux.odin | 14 |
3 files changed, 22 insertions, 18 deletions
diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin index 36cd13804..818909923 100644 --- a/core/os/os_darwin.odin +++ b/core/os/os_darwin.odin @@ -186,7 +186,7 @@ RTLD_FIRST :: 0x100; // "Argv" arguments converted to Odin strings args := _alloc_command_line_arguments(); -_File_Time :: struct { +Unix_File_Time :: struct { seconds: i64, nanoseconds: i64, } @@ -200,10 +200,10 @@ Stat :: struct { gid: u32, // Group ID of the file's group rdev: i32, // Device ID, if device - last_access: _File_Time, // Time of last access - modified: _File_Time, // Time of last modification - status_change: _File_Time, // Time of last status change - created: _File_Time, // Time of creation + last_access: Unix_File_Time, // Time of last access + modified: Unix_File_Time, // Time of last modification + status_change: Unix_File_Time, // Time of last status change + created: Unix_File_Time, // Time of creation size: i64, // Size of the file, in bytes blocks: i64, // Number of blocks allocated for the file diff --git a/core/os/os_freebsd.odin b/core/os/os_freebsd.odin index 03c44a1ae..fa439141e 100644 --- a/core/os/os_freebsd.odin +++ b/core/os/os_freebsd.odin @@ -144,7 +144,7 @@ RTLD_NOLOAD :: 0x02000; args := _alloc_command_line_arguments(); -_File_Time :: struct { +Unix_File_Time :: struct { seconds: i64, nanoseconds: c.long, } @@ -162,10 +162,10 @@ Stat :: struct { _padding1: i32, rdev: u64, - last_access: File_Time, - modified: File_Time, - status_change: File_Time, - birthtime: File_Time, + last_access: Unix_File_Time, + modified: Unix_File_Time, + status_change: Unix_File_Time, + birthtime: Unix_File_Time, size: i64, blocks: i64, @@ -328,7 +328,8 @@ last_write_time :: proc(fd: Handle) -> (File_Time, Errno) { if err != ERROR_NONE { return 0, err; } - return File_Time(s.modified), ERROR_NONE; + modified := s.modified.seconds * 1_000_000_000 + s.modified.nanoseconds; + return File_Time(modified), ERROR_NONE; } last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) { @@ -336,7 +337,8 @@ last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) { if err != ERROR_NONE { return 0, err; } - return File_Time(s.modified), ERROR_NONE; + modified := s.modified.seconds * 1_000_000_000 + s.modified.nanoseconds; + return File_Time(modified), ERROR_NONE; } stat :: inline proc(path: string) -> (Stat, Errno) { diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin index 275a1cf81..cfa5f9c44 100644 --- a/core/os/os_linux.odin +++ b/core/os/os_linux.odin @@ -179,7 +179,7 @@ RTLD_GLOBAL :: 0x100; // "Argv" arguments converted to Odin strings args := _alloc_command_line_arguments(); -_File_Time :: struct { +Unix_File_Time :: struct { seconds: i64, nanoseconds: i64, } @@ -197,9 +197,9 @@ Stat :: struct { block_size: i64, // Optimal bllocksize for I/O blocks: i64, // Number of 512-byte blocks allocated - last_access: File_Time, // Time of last access - status_change: File_Time, // Time of last status change - modified: File_Time, // Time of last modification + last_access: Unix_File_Time, // Time of last access + modified: Unix_File_Time, // Time of last modification + status_change: Unix_File_Time, // Time of last status change _reserve1, _reserve2, @@ -364,7 +364,8 @@ last_write_time :: proc(fd: Handle) -> (File_Time, Errno) { if err != ERROR_NONE { return 0, err; } - return File_Time(s.modified), ERROR_NONE; + modified := s.modified.seconds * 1_000_000_000 + s.modified.nanoseconds; + return File_Time(modified), ERROR_NONE; } last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) { @@ -372,7 +373,8 @@ last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) { if err != ERROR_NONE { return 0, err; } - return File_Time(s.modified), ERROR_NONE; + modified := s.modified.seconds * 1_000_000_000 + s.modified.nanoseconds; + return File_Time(modified), ERROR_NONE; } stat :: inline proc(path: string) -> (Stat, Errno) { |