Quick small post:
Whenever you face an error like: Undefined reference to `clock_gettime` while ‘make’, it would be a good idea to edit the makefile and add the following:
LDADD = -lrt
Define this around CXXFLAGS , LDFLAGS etc.
Once defined, make sure that at the end of the file you have the following order of variables (note: some may be missing too).
$(CXX) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LDADD)