Portable local mtime_ns for assertions (mirrors artifact.c's art_stat_mtime_ns * and pipeline_incremental.c's stat_mtime_ns — all three must agree or a * restamped row would never match the incremental classifier). */
| 721 | * and pipeline_incremental.c's stat_mtime_ns — all three must agree or a |
| 722 | * restamped row would never match the incremental classifier). */ |
| 723 | static int64_t t_mtime_ns(const char *path) { |
| 724 | struct stat st; |
| 725 | if (stat(path, &st) != 0) { |
| 726 | return -1; |
| 727 | } |
| 728 | #ifdef __APPLE__ |
| 729 | return (int64_t)st.st_mtimespec.tv_sec * 1000000000LL + (int64_t)st.st_mtimespec.tv_nsec; |
| 730 | #elif defined(_WIN32) |
| 731 | return (int64_t)st.st_mtime * 1000000000LL; |
| 732 | #else |
| 733 | return (int64_t)st.st_mtim.tv_sec * 1000000000LL + (int64_t)st.st_mtim.tv_nsec; |
| 734 | #endif |
| 735 | } |
| 736 | |
| 737 | /* True iff <repo>/.codebase-memory/artifact.json contains substr. */ |
| 738 | static bool meta_contains(const char *repo, const char *substr) { |