Workaround for missing clock_gettime() in OS

Ok cleaned my repo. Here is the patch again. For the source of the code used see gist #1087739 by Juan Batiz-Benet(jbenet)