From: Conor Daly (conor.daly at domain met.ie)
Date: Wed 27 Jun 2001 - 21:47:41 IST
I need a function / formula to return an interval in minutes subject to the
following criteria:
1. start_time and end_time are in minutes (1440 minutes is 24 hours).
2. if start_time is yesterday, start_time < 0
3. if end_time is tomorrow, end_time < 0
4. otherwise, start_time and end_time are > 0 and are equal to the
appropriate value in minutes
Ideally, i'd like something simple like:
interval = end_time - start_time
but that fails for end_time < 0 Brain's drying up at this stage (need
beer!). Best I have is:
if ( end_time < 0 ) {
interval = 1440 - end_time - start_time
}
else {
interval = end_time - start_time
}
can I do better than that?
Conor
-- Conor Daly Met Eireann, Glasnevin Hill, Dublin 9, Ireland Ph +353 1 8064276 Fax +353 1 8064275 ------------------------------------ 8:23pm up 34 days, 7:25, 13 users, load average: 2.28, 2.08, 2.17
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:10:53 GMT