made time more typesafe and c++11 like in various places