diff --git a/lib/Simba/CA.pm b/lib/Simba/CA.pm index 5907630..6a144a2 100644 --- a/lib/Simba/CA.pm +++ b/lib/Simba/CA.pm @@ -543,6 +543,14 @@ sub db_record_version { my $t2b = gettimeofday(); $self->{times}{db_record_version_versions2_get_version_id} += $t2b - $t2a; unless ($version_id) { + # We use a 32 bit int field in the database, so we have to clamp the mtime to that range. + # Need to fix this sometime before 2038 :-) + if ($f->{m} < -2147483648) { + $f->{m} = -2147483648; + } elsif ($f->{m} > 2147483647) { + $f->{m} = 2147483647; + } + $self->log(10, "insert into versions2(..., file_mtime=$f->{m}, ...)"); # XXX why is $f->{checksum} undef here for ./bin/dash? $self->{dbh}->do("insert into versions2( file_type, file_size, file_mtime,