Renamed variables, because "tm" was used as a variable name (time_t tm) and as a type (struct tm *tmp), which is confusing.