avoid c-style casts, use signed time, compile with clang