time convert moved into a named function