We need more info. From that snippet, it isn't apparent what format your input data takes so it may simply be you not supplying the values correctly converted. Also, if I understand correctly, you're using the files' timestamps? In that case you can just
stat() the file and get, among others, it's 32bit Unix timestamp.
Makeshifts last the longest.