// Lower units of seconds
// Compiled with g++ (GCC) 4.3.3
#include <iostream>
#include <ctime>
#include <sys/time.h>

int main()
{
  struct   timeval  tv;
  struct   timezone tz;
  struct   tm      *tm;
  long int hh, mm, ss, us;
  double   ms;

  gettimeofday(&tv, &tz);
  tm = localtime(&tv.tv_sec);

  hh = tm->tm_hour;        // hours
  mm = tm->tm_min;         // minutes
  ss = tm->tm_sec;         // seconds

  us = tv.tv_usec;         // micro seconds
  ms = tv.tv_usec*1.0e-3;  // mili seconds

  std::cout << hh << ':'  << mm << ':'  << ss << '\n'
            << us << '\t' << ms << std::endl;

 return 0;
}
