I do not know if the ROS have sub-string manipulation capabilities, but if there is no standard function to convert that string to time (I wonder, what is the format of :totime function?) then you have to seek that route. Note: Speed impact to your running system will be awful and I hope you need not run that very often.
“:totime” merely converts types. You need to have either a number or a string, which can be interpreted into a “time” type.
The problem is that the “time” type is not relative to any COMMON point in time. In other words, “10:00:00”, according to the “time” type is “10 hours after some undefined point in time”, not “10 hours since today’s 00:00” (as is the case with the clock) or “10 hours since 1st January 1970” (as is the case with timestamps).
@Zeup
As it so happens, there’s been a recent topic in the forum that might help. Convert both dates to timestamps, and compare the timestamps.