change message tm to time_t
fixed some thread code
fixed some thread code
add random sleep in thread