Made time_class thread safe

This should fix #189 and might close #182