modify clock2 functions by duxu.