FUNCTION TimeStandardize, t ;+ ; NAME: ; TimeStandardize ; PURPOSE: ; Standardize times ; CATEGORY: ; gen/idl/toolbox/time ; CALLING SEQUENCE: ; u = TimeStandardize(t) ; INPUTS: ; t array; type: time structure ; times ; OUTPUTS: ; t array; type: time structure ; standardized times ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; TimePieces ; SIDE EFFECTS: ; Uses !TimeUnits.in_day ; PROCEDURE: ; Makes sure that the fraction of days stored in t.units ; is a positive fraction and less than one day. ; MODIFICATION HISTORY: ; JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- s = TimePieces(/unit, t) d = s/!TimeUnits.in_day s = s-d*!TimeUnits.in_day n = where(s LT 0) IF n[0] NE -1 THEN BEGIN d[n] = d[n]-1 s[n] = s[n]+!TimeUnits.in_day ENDIF u = t u = TimePieces(/days, u, d, /add) u = TimePieces(/unit, u, s) RETURN, u & END