[Date Prev][Date Next] [Chronological] [Thread] [Top]

check_time_syntax (ITS#713)



Full_Name: Norbert Klasen
Version: HEAD
OS: Linux
URL: ftp://ftp.openldap.org/incoming/Norbert-Klasen-20000906.patch
Submission from: (NULL) (134.2.3.101)


The check_time_syntax routine in schema_init.c has some bugs
- leap years are not handeled correctly
- months with only 30 days may have 31 (e.g. 20000631)
- timezone offsets are normalized in the wrong direction: CEST = GMT + 0200, 
so if it is 1800 CEST (1800+0200) it is 1600 GMT - not 2000 GMT
- a % b (b>=0) is negative if a<0; results in a wrong index for month 
during normalization in a date like 20000101000000-0100

I don't think these erros affect operational attributes but user attributes of 
generalized time syntax may be adversely affected.

the uploaded patch fixes these issues, but two questions persist:
- what about differences between local time and Coordinated Universal Time 
like +1201 ? They are currently allowed.
- according to ISO 8601 5.3.2 "Midnight will normally be represented as [0000] 
or [2400]". However currenty 2400 will not be accepted as valid time.

I wrote a little external program that calles check_time_syntax for various
dates. 
Here are the results (3 lines for each date: entered date, normalized date with

updated routine and normalized date with routine from 2.0.0):

1999-12-31 23:00:01 +0100
1999-12-31 22:00:01 Z
1999-12-32 00:00:01 Z

2000-12-31 23:00:01 +0100
2000-12-31 22:00:01 Z
2000-12-32 00:00:01 Z

2099-12-31 23:00:01 +0100
2099-12-31 22:00:01 Z
2099-12-32 00:00:01 Z

1999-01-01 00:00:01 -0100
1999-01-01 01:00:01 Z
1998-12-01 23:00:01 Z

2000-01-01 00:00:01 -0100
2000-01-01 01:00:01 Z
1999-12-01 23:00:01 Z

2001-01-01 00:00:01 -0030
2001-01-01 00:30:01 Z
2000-12-01 23:30:01 Z

1999-01-01 00:00:01 -0030
1999-01-01 00:30:01 Z
1998-12-01 23:30:01 Z

2000-01-01 00:00:01 -0030
2000-01-01 00:30:01 Z
1999-12-01 23:30:01 Z

2001-01-01 00:00:01 -0100
2001-01-01 01:00:01 Z
2000-12-01 23:00:01 Z

2000-02-29 23:00:01 +0100
2000-02-29 22:00:01 Z
2000-03-01 00:00:01 Z

2100-02-29 23:00:01 +0100
invalid
2100-03-01 00:00:01 Z

1999-02-29 23:00:01 +0100
invalid
1999-03-01 00:00:01 Z

2000-02-28 23:00:01 +0100
2000-02-28 22:00:01 Z
2000-02-29 00:00:01 Z

2100-02-28 23:00:01 +0100
2100-02-28 22:00:01 Z
2100-02-29 00:00:01 Z

1999-02-28 23:00:01 +0100
1999-02-28 22:00:01 Z
1999-02-29 00:00:01 Z

1999-03-01 00:00:01 -0100
1999-03-01 01:00:01 Z
1999-02-29 23:00:01 Z

2000-03-01 00:00:01 -0100
2000-03-01 01:00:01 Z
2000-02-29 23:00:01 Z

2100-03-01 00:00:01 -0100
2100-03-01 01:00:01 Z
2100-02-29 23:00:01 Z

2000-06-30 23:00:01 +0100
2000-06-30 22:00:01 Z
2000-06-31 00:00:01 Z

2100-06-30 23:00:01 +0100
2100-06-30 22:00:01 Z
2100-06-31 00:00:01 Z

1999-06-30 23:00:01 +0100
1999-06-30 22:00:01 Z
1999-06-31 00:00:01 Z

1999-07-01 00:00:01 -0100
1999-07-01 01:00:01 Z
1999-06-31 23:00:01 Z

2000-07-01 00:00:01 -0100
2000-07-01 01:00:01 Z
2000-06-31 23:00:01 Z

2100-07-01 00:00:01 -0100
2100-07-01 01:00:01 Z
2100-06-31 23:00:01 Z

2000-09-05 16:00:00 Z
2000-09-05 16:00:00 Z
2000-09-05 16:00:00 Z

2000-09-05 18:00:00 +0200
2000-09-05 16:00:00 Z
2000-09-05 20:00:00 Z

2000-09-05 18:00:00 +0270
invalid
invalid

2000-09-05 18:00:00 +1400
invalid
invalid

2000-09-05 18:00:00 -1201
2000-09-06 06:01:00 Z
2000-09-05 05:59:00 Z

2000-01-45 00:00:00 Z
invalid
invalid

2000-01-00 00:00:00 Z
invalid
invalid

2000-13-01 00:00:00 Z
invalid
invalid

2000-13-00 00:00:00 Z
invalid
invalid

2000-12-01 24:00:00 Z
invalid
invalid

2000-13-01 00:77:00 Z
invalid
invalid

2000-06-31 12:34:56 Z
invalid
2000-06-31 12:34:56 Z

1999-12-31 23:00:01 -0100
2000-01-01 00:00:01 Z
1999-12-31 22:00:01 Z

2000-12-31 23:00:01 -0100
2001-01-01 00:00:01 Z
2000-12-31 22:00:01 Z

2099-12-31 23:00:01 -0100
2100-01-01 00:00:01 Z
2099-12-31 22:00:01 Z

1999-01-01 00:00:01 +0100
1998-12-31 23:00:01 Z
1999-01-01 01:00:01 Z

2000-01-01 00:00:01 +0100
1999-12-31 23:00:01 Z
2000-01-01 01:00:01 Z

2001-01-01 00:00:01 +0030
2000-12-31 23:30:01 Z
2001-01-01 00:30:01 Z

1999-01-01 00:00:01 +0030
1998-12-31 23:30:01 Z
1999-01-01 00:30:01 Z

2000-01-01 00:00:01 +0030
1999-12-31 23:30:01 Z
2000-01-01 00:30:01 Z

2001-01-01 00:00:01 +0100
2000-12-31 23:00:01 Z
2001-01-01 01:00:01 Z

2000-02-29 23:00:01 -0100
2000-03-01 00:00:01 Z
2000-02-29 22:00:01 Z

2100-02-29 23:00:01 -0100
invalid
2100-02-29 22:00:01 Z

1999-02-29 23:00:01 -0100
invalid
1999-02-29 22:00:01 Z

2000-02-28 23:00:01 -0100
2000-02-29 00:00:01 Z
2000-02-28 22:00:01 Z

2100-02-28 23:00:01 -0100
2100-03-01 00:00:01 Z
2100-02-28 22:00:01 Z

1999-02-28 23:00:01 -0100
1999-03-01 00:00:01 Z
1999-02-28 22:00:01 Z

1999-03-01 00:00:01 +0100
1999-02-28 23:00:01 Z
1999-03-01 01:00:01 Z

2000-03-01 00:00:01 +0100
2000-02-29 23:00:01 Z
2000-03-01 01:00:01 Z

2100-03-01 00:00:01 +0100
2100-02-28 23:00:01 Z
2100-03-01 01:00:01 Z

2000-06-30 23:00:01 -0100
2000-07-01 00:00:01 Z
2000-06-30 22:00:01 Z

2100-06-30 23:00:01 -0100
2100-07-01 00:00:01 Z
2100-06-30 22:00:01 Z

1999-06-30 23:00:01 -0100
1999-07-01 00:00:01 Z
1999-06-30 22:00:01 Z

1999-07-01 00:00:01 +0100
1999-06-30 23:00:01 Z
1999-07-01 01:00:01 Z

2000-07-01 00:00:01 +0100
2000-06-30 23:00:01 Z
2000-07-01 01:00:01 Z

2100-07-01 00:00:01 +0100
2100-06-30 23:00:01 Z
2100-07-01 01:00:01 Z

and the copyright statement according to the conributing guidelines

Copyright 2000, Norbert Klasen, All rights reserved.
      This software is not subject to any license of 
      Universitaet Tuebingen.

      This is free software; you can redistribute and use it
      under the same terms as OpenLDAP itself.