define max_time as boost::uint32_t and you will not need to cast variables