Although I do not think there is a function for this, you can do it quite easily if you do not need this day.
struct timeval now; unsinged int temp, second, minute, hour; do_gettimeofday(&now); temp = now.tv_sec; second = temp%60; temp /= 60; minute = temp%60; temp /= 60; hour = temp%24; printf("%02d:%02d:%02d:%06d\n", hour, minute, second, now.tv_usec);
Please note that you are getting GMT, not local time.
ugoren
source share