Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 1 | Y2K compliance in libpng: |
| 2 | ========================= |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 3 | |
Glenn Randers-Pehrson | ec61c23 | 2000-05-16 06:17:36 -0500 | [diff] [blame^] | 4 | May 16, 2000 |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 5 | |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 6 | Since the PNG Development group is an ad-hoc body, we can't make |
| 7 | an official declaration. |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 8 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 9 | This is your unofficial assurance that libpng from version 0.71 and |
Glenn Randers-Pehrson | ec61c23 | 2000-05-16 06:17:36 -0500 | [diff] [blame^] | 10 | upward through 1.0.7beta13 are Y2K compliant. It is my belief that earlier |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 11 | versions were also Y2K compliant. |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 12 | |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 13 | Libpng only has three year fields. One is a 2-byte unsigned integer |
| 14 | that will hold years up to 65535. The other two hold the date in text |
| 15 | format, and will hold years up to 9999. |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 16 | |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 17 | The integer is |
| 18 | "png_uint_16 year" in png_time_struct. |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 19 | |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 20 | The strings are |
| 21 | "png_charp time_buffer" in png_struct and |
| 22 | "near_time_buffer", which is a local character string in png.c. |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 23 | |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 24 | There are seven time-related functions: |
| 25 | |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 26 | png_convert_to_rfc_1123() in png.c |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 27 | (formerly png_convert_to_rfc_1152() in error) |
| 28 | png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c |
| 29 | png_convert_from_time_t() in pngwrite.c |
| 30 | png_get_tIME() in pngget.c |
| 31 | png_handle_tIME() in pngrutil.c, called in pngread.c |
| 32 | png_set_tIME() in pngset.c |
| 33 | png_write_tIME() in pngwutil.c, called in pngwrite.c |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 34 | |
| 35 | All appear to handle dates properly in a Y2K environment. The |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 36 | png_convert_from_time_t() function calls gmtime() to convert from system |
| 37 | clock time, which returns (year - 1900), which we properly convert to |
| 38 | the full 4-digit year. There is a possibility that applications using |
| 39 | libpng are not passing 4-digit years into the png_convert_to_rfc_1123() |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 40 | function, or that they are incorrectly passing only a 2-digit year |
| 41 | instead of "year - 1900" into the png_convert_from_struct_tm() function, |
| 42 | but this is not under our control. The libpng documentation has always |
| 43 | stated that it works with 4-digit years, and the APIs have been |
| 44 | documented as such. |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 45 | |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 46 | The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned |
| 47 | integer to hold the year, and can hold years as large as 65535. |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 48 | |
| 49 | zlib, upon which libpng depends, is also Y2K compliant. It contains |
| 50 | no date-related code. |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 51 | |
| 52 | |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 53 | Glenn Randers-Pehrson |
| 54 | libpng maintainer |
| 55 | PNG Development Group |