source: IHS-VA_UTILITIES-XB/trunk/XBDIFF.m@ 1641

Last change on this file since 1641 was 642, checked in by Sam Habiel, 15 years ago

Modified directory structure; moved routines.

File size: 1.3 KB
Line 
1XBDIFF ; IHS/ADC/GTH - RETURN DIFFERENCE BETWEEN TWO DATE/TIMES ; [ 02/07/97 3:02 PM ]
2 ;;4.0;XB;;Jul 20, 2009;Build 2
3 ;
4 ; Passed two date/times this routine returns the difference
5 ; in days, hours, minutes, seconds separated by colons ":".
6 ;
7 ; The date/times must be passed in the variables X and X1.
8 ; The result will be returned in X. X1 will be killed.
9 ;
10 ; If either X or X1 are invalid X will be returned as -1 and
11 ; X1 will be killed.
12 ;
13 ; The date/times may be passed in $HOROLOG format or in
14 ; internal FileMan format.
15 ;
16 ; See also, $$FMDIFF^XLFDT, and $$HDIFF^XLFDT.
17 ;
18START ;
19 NEW A,B,C,D,E,F,G
20 D EDIT
21 Q:X<0
22 S:X>X1 A=X,X=X1,X1=A
23 I X?5N1","5N S A=$P(X,",",1),B=$P(X,",",2) I 1
24 E D H^%DTC S A=%H,B=%T
25 I X1?5N1","5N S C=$P(X1,",",1),D=$P(X1,",",2) I 1
26 E S X=X1 D H^%DTC S C=%H,D=%T
27 S E=C-A S:D<B E=E-1,D=D+86400 S D=D-B,F=D\3600,D=D-(F*3600),G=D\60,D=D-(G*60)
28 S X=E_":"_F_":"_G_":"_D
29 KILL %H,%T,%Y,A,B,C,D,E,F,G,X1
30 Q
31 ;
32EDIT ; EDIT INPUT
33 D EDITX
34 Q:X<0
35 D EDITX1
36 Q:X<0
37 I X?5N1"."5N D Q
38 . I $P(X,".",2)>86399 S X=-1 KILL X1
39 . Q
40 S A=$P(X,".",2)
41 I +$E(A,1,2)<24,+$E(A,3,4)<60,+$E(A,5,6)<60 Q
42 E S X=-1 KILL X1
43 KILL A
44 Q
45 ;
46EDITX ; EDIT X
47 Q:X?5N1"."5N
48 Q:X?7N
49 Q:X?7N1"."1.6N
50 S X=-1
51 KILL X1
52 Q
53 ;
54EDITX1 ; EDIT X1
55 Q:X?5N1"."5N
56 Q:X?7N
57 Q:X?7N1"."1.6N
58 S X=-1
59 KILL X1
60 Q
61 ;
Note: See TracBrowser for help on using the repository browser.