Browse Source

Merge branch 'master' of https://github.com/odin-lang/Odin

gingerBill 4 years ago
parent
commit
6523aefdcc
3 changed files with 22 additions and 18 deletions
  1. 5 5
      core/os/os_darwin.odin
  2. 9 7
      core/os/os_freebsd.odin
  3. 8 6
      core/os/os_linux.odin

+ 5 - 5
core/os/os_darwin.odin

@@ -186,7 +186,7 @@ RTLD_FIRST    :: 0x100;
 // "Argv" arguments converted to Odin strings
 // "Argv" arguments converted to Odin strings
 args := _alloc_command_line_arguments();
 args := _alloc_command_line_arguments();
 
 
-_File_Time :: struct {
+Unix_File_Time :: struct {
 	seconds: i64,
 	seconds: i64,
 	nanoseconds: i64,
 	nanoseconds: i64,
 }
 }
@@ -200,10 +200,10 @@ Stat :: struct {
 	gid:           u32, // Group ID of the file's group
 	gid:           u32, // Group ID of the file's group
 	rdev:          i32, // Device ID, if device
 	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
 	size:          i64,  // Size of the file, in bytes
 	blocks:        i64,  // Number of blocks allocated for the file
 	blocks:        i64,  // Number of blocks allocated for the file

+ 9 - 7
core/os/os_freebsd.odin

@@ -144,7 +144,7 @@ RTLD_NOLOAD       :: 0x02000;
 
 
 args := _alloc_command_line_arguments();
 args := _alloc_command_line_arguments();
 
 
-_File_Time :: struct {
+Unix_File_Time :: struct {
 	seconds: i64,
 	seconds: i64,
 	nanoseconds: c.long,
 	nanoseconds: c.long,
 }
 }
@@ -162,10 +162,10 @@ Stat :: struct {
 	_padding1: i32,
 	_padding1: i32,
 	rdev: u64,
 	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,
 	size: i64,
 	blocks: i64,
 	blocks: i64,
@@ -328,7 +328,8 @@ last_write_time :: proc(fd: Handle) -> (File_Time, Errno) {
 	if err != ERROR_NONE {
 	if err != ERROR_NONE {
 		return 0, err;
 		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) {
 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 {
 	if err != ERROR_NONE {
 		return 0, err;
 		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) {
 stat :: inline proc(path: string) -> (Stat, Errno) {

+ 8 - 6
core/os/os_linux.odin

@@ -179,7 +179,7 @@ RTLD_GLOBAL       :: 0x100;
 // "Argv" arguments converted to Odin strings
 // "Argv" arguments converted to Odin strings
 args := _alloc_command_line_arguments();
 args := _alloc_command_line_arguments();
 
 
-_File_Time :: struct {
+Unix_File_Time :: struct {
 	seconds:     i64,
 	seconds:     i64,
 	nanoseconds: i64,
 	nanoseconds: i64,
 }
 }
@@ -197,9 +197,9 @@ Stat :: struct {
 	block_size:    i64, // Optimal bllocksize for I/O
 	block_size:    i64, // Optimal bllocksize for I/O
 	blocks:        i64, // Number of 512-byte blocks allocated
 	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,
 	_reserve1,
 	_reserve2,
 	_reserve2,
@@ -364,7 +364,8 @@ last_write_time :: proc(fd: Handle) -> (File_Time, Errno) {
 	if err != ERROR_NONE {
 	if err != ERROR_NONE {
 		return 0, err;
 		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) {
 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 {
 	if err != ERROR_NONE {
 		return 0, err;
 		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) {
 stat :: inline proc(path: string) -> (Stat, Errno) {