abs() is for ints
(and you are not using ints)
labs() is for longs
llabs() is for long longs
Look at the man page for abs() it will show all the various forms of the functions.
Not sure which library you are using but most use a time_t type to represent the time so you should use the type that the library uses rather than use a native type.
The reason being is that there is no guarantee what a time_t is or how many bits it is. Many now use 64 bits and while some still use 32 bits, in 32 bit environments many use an unsigned long to try to avoid the upcoming 2038 issue that happens when 32 bit time rolls over since bit 31 gets set in January 2038.
But you should not need to deal with this as long as you use the proper type and create a delta.
delta = time2 - time1;
The issue you may run into is if for some reason you don't know which is time1 vs time2 and always want a positive delta.
In that case, you will have to do some compile time conditional checks to make sure you are using the proper "abs" function for the width of your data if your library doesn't provide such a function. Not hard but a bit messy.
However, once you have a delta in time_t you will still need to convert that to whatever you want to see:
seconds, minutes, hours... etc...
This is because a time_t is not guaranteed to be seconds, you must then use functions, or macros provided by the library to do the conversion to what you want.