Time Calculations
1 Attachment(s)
Hello all,
I have written a Bash script that kind-of works. My end goal is to calculate the time difference between the two times that I input. The reason that I say that my script kind-of works is that it sometimes calculates the correct values that I want. If I input 22, 0, 6, 0 then the output will be the correct value of 8. Any help on this issue would be greatly appreciated. :) |
What issue ?
|
Here's the script
Code:
#!/bin/bash |
Why not use the %s argument to date instead? It will remove the 0/24 ambiguity.
Code:
blah Code:
if [[ $new_waketime_hour -lt $new_sleeptime_hour ]]; then %s will be simpler and more robust. |
Thank you all for your posts! I am trying to learn Bash and I tried my best at it before I submited my issue to this forum. Anywho, I will definately try out all of your sugestions tonight. :)
|
Hi,
I'd like to present you a little more complex Bash time operations like here with the essential part of doing it: Quote:
a quick example displaying time: Quote:
|
All times are GMT -5. The time now is 10:08 PM. |