diff options
author | Andy Wingo <wingo@pobox.com> | 2011-06-16 20:01:56 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-06-16 20:01:56 +0200 |
commit | 99cc1092a89292c6e6db2db537988e5963b19868 (patch) | |
tree | 94f69d35c6328c2ab83304d8996a2dd957cac529 /lib/stat-time.h | |
parent | 46da7909e1f67c13284730344e971d293df890c0 (diff) | |
parent | 32f94bf258bd032fa6f96fc76e4153086bc001f5 (diff) | |
download | guile-99cc1092a89292c6e6db2db537988e5963b19868.tar.gz |
Merge remote-tracking branch 'local-2.0/stable-2.0'
Diffstat (limited to 'lib/stat-time.h')
-rw-r--r-- | lib/stat-time.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/stat-time.h b/lib/stat-time.h index 47a288a7e..2d0191096 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -142,7 +142,7 @@ get_stat_mtime (struct stat const *st) } /* Return *ST's birth time, if available; otherwise return a value - with negative tv_nsec. */ + with tv_sec and tv_nsec both equal to -1. */ static inline struct timespec get_stat_birthtime (struct stat const *st) { @@ -161,7 +161,7 @@ get_stat_birthtime (struct stat const *st) t.tv_sec = st->st_ctime; t.tv_nsec = 0; #else - /* Birth time is not supported. Set tv_sec to avoid undefined behavior. */ + /* Birth time is not supported. */ t.tv_sec = -1; t.tv_nsec = -1; /* Avoid a "parameter unused" warning. */ @@ -175,10 +175,12 @@ get_stat_birthtime (struct stat const *st) using zero. Attempt to work around this problem. Alas, this can report failure even for valid time stamps. Also, NetBSD sometimes returns junk in the birth time fields; work around this - bug if it is detected. There's no need to detect negative - tv_nsec junk as negative tv_nsec already indicates an error. */ - if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec) - t.tv_nsec = -1; + bug if it is detected. */ + if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) + { + t.tv_sec = -1; + t.tv_nsec = -1; + } #endif return t; |