[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: date calculations library



I thought the members of this list might be interested in this package.
While meant for perl, it's been designed to allow the C portion to be used
as a standalone library.

-- 
C. Harald Koch          | Senior System Developer,Secure Computing Canada Ltd.
chk@border.com          | 20 Toronto Street, Suite 400, Toronto ON M5C 2B8 
+1 416 368 7157 (voice) | "Madness takes its toll. Please have exact change."
+1 416 368 7789 (fax)   |		-Karen Murphy <karenm@descartes.com>
--- Begin Message ---
=======================================
  Module "Date::DateCalc" Version 2.3
=======================================

This new version fixes a problem that showed up with Perl 5.003:
Calling "malloc" in the C part of the module (compiled separately and
without the "perl.h" header file) and "free()" in the XSUB produced
"bad free() ignored" warnings. Now "free()" is also called in the
C library of the module.

Requirements:
-------------

Perl version 5.000 or higher, a compiler complying with ANSI C standards (!).
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What does it do:
----------------

The package provides a Perl interface to a C library which offers a wide
variety of date calculations based on the Gregorian calendar (the one
used in all western countries today), complying with the ISO/R 2015-1971
and DIN 1355 standards which specify things as what leap years are, when
they occur, how the week numbers are defined, what's the first day of the
week, how many weeks (52 or 53) a given year has, and so on.
 
Although the Gregorian calendar was only adopted 1582 by most (not all)
European countries (some countries continued to use the Julian calendar
until as late as the end of the 18th century!), this package allows to
project the Gregorian calendar back until the year 1 (independently of
how much sense this makes).

This module is not intended to be the most comfortable approach to every
date calculation problem there is, but instead it's meant to be a *minimal*
and *complete* (in the sense of computation theory!) set of tools to solve
any date calculation problem you might ever encounter.

Therefore, the interfaces of these routines are designed for a maximum of
flexibility and a minimum of overhead. Just like the UNIX commands "cat",
"grep" and so on which do very simple tasks but can do many useful jobs
when combined in a cunning way, the routines in this package are intended
to be *elementary*, i.e., undivisible basic functions.

Moreover, the module is mainly written in C so that the C part can be used
as a stand-alone library in other applications than Perl. (!!!)

To give you an idea of what the package can do, here a list of all the
functions it exports:

  $flag = leap($year);
  $date = compress($yy,$mm,$dd);
  ($cc,$yy,$mm,$dd) = uncompress($date);
  $flag = check_compressed($date);
  $datestr = compressed_to_short($date);
  $flag = check_date($year,$mm,$dd);
  $days = calc_days($year,$mm,$dd);
  $weekday = day_of_week($year,$mm,$dd);
  $days = dates_difference($year1,$mm1,$dd1,$year2,$mm2,$dd2);
  ($year,$mm,$dd) = calc_new_date($year,$mm,$dd,$offset);
  ($days,$hh,$mm,$ss) = date_time_difference
  (
      $year1,$month1,$day1,$hh1,$mm1,$ss1,
      $year2,$month2,$day2,$hh2,$mm2,$ss2
  );
  ($year,$month,$day,$hh,$mm,$ss) = calc_new_date_time
  (
      $year,$month,$day,$hh,$mm,$ss,
      $days_offset,$hh_offset,$mm_offset,$ss_offset
  );
  $datestr = date_to_short($year,$mm,$dd);
  $datestr = date_to_string($year,$mm,$dd);
  ($week,$year) = week_number($year,$mm,$dd);
  ($year,$mm,$dd) = first_in_week($week,$year);
  $weeks = weeks_in_year($year);
  $day_name = day_name_tab($weekday);
  $month_name = month_name_tab($month);
  $weekday = decode_day($day_name);
  $month = decode_month($month_name);
  ($year,$mm,$dd) = decode_date($date);
  $days = days_in_month($year,$mm);
  $version = Date::DateCalc::Version();

For more details, see the Date::DateCalc(3) man page!

Thanks:
-------

Many thanks to Tim Zingelman <zingelman@fnal.gov> for reporting the problem
fixed in version 2.3 and for testing an intermediate new version of this
module on his machine!

Where to find:
--------------

At the usual ftp sites for Perl (CPAN = "Comprehensive Perl Archive Network"),

under     .../CPAN/authors/id/STBEY/

or        .../CPAN/modules/by-category/06_Data_Type_Utilities/Date/

or        .../CPAN/modules/by-module/Date/

(See "The Perl 5 Module List" by Tim Bunce and Andreas Koenig
in news:comp.lang.perl.modules for a list of CPAN ftp servers)

Final note:
-----------

If you need any assistance or have any comments, problems, suggestions,
findings, complaints, questions, insights, compliments or donations to give ;-)
then please don't hesitate to send me a mail:

sb@sdm.de (Steffen Beyer)

Yours,
--
Steffen Beyer ________________________ C:\ONGRATLN.W95 _______________________
mailto:sb@sdm.de         |s  |d &|m  | software design & management GmbH&Co.KG
phone: +49 89 63812-244  |   |   |   | Thomas-Dehler-Str. 27
fax:   +49 89 63812-150  |   |   |   | 81737 Munich, Germany.



--- End Message ---