Two Date substraction
Need your expert advice on the date comparison
We login to ADFS to fetch the token and use the same token for all the subsequent programs until the token is expired.
In order to achieve we store the TOKEN in a file and it also has the expire time parameter which is in seconds.
So everytime we hit the endpoint with the TOKEN we should see if the TOKEN is still active else need to login and fetch new TOKEN.
So lets assume the the expiry time is 3 hours which is 10800 seconds, so if a user fetch the token at 10:00 AM ideally the token should be valid until 01;00 PM. So i have placed the expiry time value 10800 seconds in a file and added it to the current time and derived the expiry time as 01:00 PM.
For every subsequent call I need to subtract the current time from the expiry time and if the current time < expiry time the REST END Point should be hit with the existing TOKEN else a new token should be fetched.
Tried many date - commands with no luck. Any pointers would be highly appreciated and we require this in BASH scripting