aboutsummaryrefslogtreecommitdiff
path: root/src/alf.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-12-02 14:58:10 -0500
committerB. Watson <urchlay@slackware.uk>2025-12-02 14:58:10 -0500
commit8998af28a197babbeaa5ae828f1229e499b193c1 (patch)
treec74b0625595b34c2637bee9babf290f444766c86 /src/alf.c
parentee459dea483ae556ca16a2a5dc9cbb26e26bb425 (diff)
downloadalftools-8998af28a197babbeaa5ae828f1229e499b193c1.tar.gz
alf: Use 0 datestamp if year out of range; unalf: Display 0 datestamps as <none>.
Diffstat (limited to 'src/alf.c')
-rw-r--r--src/alf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/alf.c b/src/alf.c
index 82c9432..d0490ab 100644
--- a/src/alf.c
+++ b/src/alf.c
@@ -108,6 +108,11 @@ unsigned long get_msdos_date_time(void) {
else
tm = localtime(&t);
+ /* use a 0 timestamp if the year's out of range, unalf will
+ display it as <none>. */
+ if(tm->tm_year < 1980 || tm->tm_year > 2107)
+ return 0;
+
msdos_year = tm->tm_year + 1900 - 1980;
/* tm_mon + 1 because MS uses 1-12 for months, and struct tm uses 0-11 */