Might be of help:
context.get_remaining_time_in_millis()
(and node/others equivalents) will give you the remaining execution time