fixed: MacOS compilation
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 18 Jan 2024 03:21:16 +0000 (21:21 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 18 Jan 2024 03:21:16 +0000 (21:21 -0600)
shared/include/bh.h

index 76bf84a4944465aed9fbbe18ea060fe524c7a99c..4a3eaa481a87ddbd66febb8d6b7da76461414ef4 100644 (file)
@@ -1919,9 +1919,17 @@ b32 bh_file_stat(char const* filename, bh_file_stats* out) {
     }
 
     out->size = s.st_size;
+
+#if defined(_BH_DARWIN)
+    // Apple just has to be different.
+    out->modified_time = timespec_to_ms(s.st_mtimespec);
+    out->accessed_time = timespec_to_ms(s.st_atimespec);
+    out->change_time   = timespec_to_ms(s.st_ctimespec);
+#else
     out->modified_time = timespec_to_ms(s.st_mtim);
     out->accessed_time = timespec_to_ms(s.st_atim);
     out->change_time   = timespec_to_ms(s.st_ctim);
+#endif
 
     if ((s.st_mode & S_IFMT) == S_IFDIR) out->file_type = BH_FILE_TYPE_DIRECTORY;
     if ((s.st_mode & S_IFMT) == S_IFREG) out->file_type = BH_FILE_TYPE_FILE;