diff options
author | Arnavion <arnavion@gmail.com> | 2014-12-14 13:31:19 -0800 |
---|---|---|
committer | Arnavion <arnavion@gmail.com> | 2014-12-14 13:31:19 -0800 |
commit | ac01ba9cb0aec33653274b14ee53b374da8db577 (patch) | |
tree | 01dc4a5378a59ecba0f313445b0de7892b9915a2 /plugins | |
parent | a537fa3ca7cc7510f74d2a72964f5c9b99ec8beb (diff) |
perl: Fixed warning about implicitly casting the time_t returned from hexchat_list_time() to an NV.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/perl/perl.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index 240e74d1..eb539902 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -288,7 +288,19 @@ list_item_to_sv ( hexchat_list *list, const char *const *fields ) field_value = newSVuv (hexchat_list_int (ph, list, field_name)); break; case 't': - field_value = newSVnv (hexchat_list_time (ph, list, field_name)); + /* From perldoc for Perl's own timelocal() and timegm(): + * <quote> + * On perl versions older than 5.12.0, the range of dates that can be actually be handled depends on the size of time_t (usually a signed integer) on the given platform. + * As of version 5.12.0, perl has stopped using the underlying time library of the operating system it's running on and has its own implementation of those routines with a + * safe range of at least +/ 2**52 (about 142 million years). + * </quote> + * + * This is further confirmed from looking at the source for Time::Local - it's a Perl module and the implementations of timelocal() and timegm() use simple addition and + * subtraction of numbers. Perl automatically promotes numbers from int32_t (IV) to uint32_t (UV) to 64-bit IEEE754 double (NV) as required. + * + * This means that using a double (NV) for our own time_t suffers from the same assumptions that Perl's own functions do. + */ + field_value = newSVnv ((const NV) hexchat_list_time (ph, list, field_name)); break; default: field_value = &PL_sv_undef; |