FUNCTION sec2hms,sec,round=rnd,debug=dbg IF sec LT 0. THEN BEGIN MESSAGE,'Negative times not allowed.' RETURN,-1 ENDIF IF sec GT 86400. THEN BEGIN MESSAGE,'Times greater than one day not allowed.' RETURN,-1 ENDIF s=sec MOD 60. IF KEYWORD_SET(dbg) THEN PRINT,s IF KEYWORD_SET(rnd) THEN s=ROUND(s) IF ROUND(s) EQ 60 THEN BEGIN s=s-60. sec=sec+1 ENDIF IF KEYWORD_SET(dbg) THEN PRINT,s m=FLOOR(sec/60.) MOD 60 IF KEYWORD_SET(dbg) THEN PRINT,m h=FLOOR(sec/3600.) IF KEYWORD_SET(dbg) THEN PRINT,h RETURN,(h*100+m)*100+s END