Commit ec8101d2 authored by Russ Kubik's avatar Russ Kubik

Increase GeneralizedTime fractional second precision to 9 digits

parent 4cc779fd
...@@ -666,13 +666,13 @@ asn_time2GT_frac(GeneralizedTime_t *opt_gt, const struct tm *tm, int frac_value, ...@@ -666,13 +666,13 @@ asn_time2GT_frac(GeneralizedTime_t *opt_gt, const struct tm *tm, int frac_value,
* Deal with fractions. * Deal with fractions.
*/ */
if(frac_value > 0 && frac_digits > 0) { if(frac_value > 0 && frac_digits > 0) {
char *end = p + 1 + 6; /* '.' + maximum 6 digits */ char *end = p + 1 + 9; /* '.' + maximum 9 digits */
char *z = p; char *z = p;
long fbase; long fbase;
*z++ = '.'; *z++ = '.';
/* Place bounds on precision */ /* Place bounds on precision */
while(frac_digits-- > 6) while(frac_digits-- > 9)
frac_value /= 10; frac_value /= 10;
/* emulate fbase = pow(10, frac_digits) */ /* emulate fbase = pow(10, frac_digits) */
......
...@@ -264,19 +264,19 @@ main(int ac, char **av) { ...@@ -264,19 +264,19 @@ main(int ac, char **av) {
RECODE("20050702123312,30000+01", "20050702113312.3Z"); RECODE("20050702123312,30000+01", "20050702113312.3Z");
RECODE("20050702123312,300000000+01", "20050702113312.3Z"); RECODE("20050702123312,300000000+01", "20050702113312.3Z");
RECODE("20050702123312.123456+01", "20050702113312.123456Z"); RECODE("20050702123312.123456+01", "20050702113312.123456Z");
RECODE("20050702123312.1234567+01", "20050702113312.123456Z"); RECODE("20050702123312.1234567+01", "20050702113312.1234567Z");
RECODE("20050702123312.12345678+01", "20050702113312.123456Z"); RECODE("20050702123312.12345678+01", "20050702113312.12345678Z");
RECODE("20050702123312.123456789+01", "20050702113312.123456Z"); RECODE("20050702123312.123456789+01", "20050702113312.123456789Z");
RECODE("20050702123312.1234567891+01", "20050702113312.123456789Z");
RECODE("20050702123312.2000000000+01", "20050702113312.2Z"); RECODE("20050702123312.2000000000+01", "20050702113312.2Z");
RECODE("20050702123312.3000000000+01", "20050702113312.3Z"); RECODE("20050702123312.3000000000+01", "20050702113312.3Z");
RECODE("20050702123312.4000000000+01", "20050702113312.4Z"); RECODE("20050702123312.4000000000+01", "20050702113312.4Z");
RECODE("20050702123312.5000000000+01", "20050702113312.5Z"); RECODE("20050702123312.5000000000+01", "20050702113312.5Z");
RECODE("20050702123312.5000000011+01", "20050702113312.500000001Z");
RECODE("20050702123312.5000000001+01", "20050702113312.5Z"); RECODE("20050702123312.5000000001+01", "20050702113312.5Z");
RECODE("20050702123312.5000010001+01", "20050702113312.500001Z"); RECODE("20050702123312.000000001+01", "20050702113312.000000001Z");
RECODE("20050702123312.5000001001+01", "20050702113312.5Z"); RECODE("20050702123312.0000000001Z", "20050702123312Z");
RECODE("20050702123312.000001+01", "20050702113312.000001Z"); RECODE("20050702123312.0080000010+1056", "20050702013712.008000001Z");
RECODE("20050702123312.0000001Z", "20050702123312Z");
RECODE("20050702123312.0080010+1056", "20050702013712.008001Z");
#endif #endif
compare(__LINE__, 0, "20040125093007", "20040125093007"); compare(__LINE__, 0, "20040125093007", "20040125093007");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment