ISOTime.java
3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.ut;
import com.adobe.xfa.ut.DateTimeUtil;
import com.adobe.xfa.ut.LcTime;
import java.util.Calendar;
import java.util.TimeZone;
public final class ISOTime
extends LcTime {
public ISOTime() {
super("en_US");
}
public ISOTime(int millis) {
super(millis, "en_US");
}
public ISOTime(String locale, int centurySplit) {
super(locale);
}
public ISOTime(String time, String locale) {
super(locale);
this.setTimeSymbols(this.mLocale.getIsoName());
String trimTime = time;
int tee = time.indexOf(84);
if (tee >= 0) {
trimTime = time.substring(tee + 1);
}
trimTime = trimTime.trim();
this.setTimeSymbols("en_US");
if (this.parse(trimTime)) {
if (!this.mTimeZoneSeen) {
Calendar now = Calendar.getInstance();
this.mTimeZone = - now.get(15);
if (TimeZone.getDefault().inDaylightTime(now.getTime())) {
this.mTimeZone -= now.get(16);
}
}
this.mMillis = ISOTime.epoch(this.mHourOfDay, this.mMinuteOfHour, this.mSecondOfMinute, this.mThousandthOfSecond, this.mTimeZone);
this.mAdjustment = 0;
this.mValid = true;
} else {
this.mMillis = 0;
this.mValid = false;
}
this.setTimeSymbols(this.mLocale.getIsoName());
}
boolean parse(String src) {
boolean needColons = src.indexOf(58) >= 0;
int srcPos = 0;
int srcLen = src.length();
this.mThousandthOfSecond = -1;
this.mSecondOfMinute = -1;
this.mMinuteOfHour = -1;
this.mHourOfDay = -1;
this.mTimeZone = -1;
this.mMeriDiem = -1;
this.mHourOfMeriDiem = -1;
this.mTimeZoneSeen = false;
if (srcPos + 2 > srcLen) {
return false;
}
int parseRes = this.subParse(src, srcPos, 'H', 2);
if (parseRes < 0) {
return false;
}
srcPos = parseRes;
if (srcPos == srcLen) {
this.mMinuteOfHour = 0;
this.mSecondOfMinute = 0;
this.mThousandthOfSecond = 0;
return true;
}
if (needColons) {
if (!DateTimeUtil.matchChr(src, srcPos, ':', false)) {
return false;
}
++srcPos;
}
if (srcPos + 2 > srcLen) {
return false;
}
parseRes = this.subParse(src, srcPos, 'M', 2);
if (parseRes < 0) {
return false;
}
srcPos = parseRes;
if (srcPos == srcLen) {
this.mSecondOfMinute = 0;
this.mThousandthOfSecond = 0;
return true;
}
if (needColons) {
if (!DateTimeUtil.matchChr(src, srcPos, ':', false)) {
return false;
}
++srcPos;
}
if (srcPos + 2 > srcLen) {
return false;
}
parseRes = this.subParse(src, srcPos, 'S', 2);
if (parseRes < 0) {
return false;
}
srcPos = parseRes;
if (srcPos == srcLen) {
this.mThousandthOfSecond = 0;
return true;
}
if (DateTimeUtil.matchChr(src, srcPos, '.', false)) {
if (++srcPos + 3 > srcLen) {
return false;
}
parseRes = this.subParse(src, srcPos, 'F', 3);
if (parseRes < 0) {
return false;
}
srcPos = parseRes;
if (srcPos == srcLen) {
return true;
}
}
if ((parseRes = this.subParse(src, srcPos, 'z', needColons ? 2 : 1)) < 0) {
return false;
}
srcPos = parseRes;
if (srcPos != srcLen) {
return false;
}
if (this.mThousandthOfSecond == -1) {
this.mThousandthOfSecond = 0;
}
return true;
}
}