[fpc-pascal] (no subject)

Seth Grover sethdgrover at gmail.com
Wed May 6 22:11:59 CEST 2009


http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/objpas/dateutil.inc?view=diff&r1=12957&r2=12958
shows that a change was recently made which replaces "Trunc" with
"Round" in the *Between routines in dateutil.inc (DaysBetween,
HoursBetween, etc.).

So this program:
---------------------------------

program Project1;

{$mode objfpc}{$H+}

uses
  Classes,SysUtils,DateUtils;

var
  val1, val2 : TDateTime;
begin
  val1 := 39939.0;
  val2 := 39939.796069305557;
  writeln(DaysBetween(val1, val2));
end.
---------------------------------

Will now print result in a "1" instead of a "0" which is what I would
have gotten before.

Now I know I can just use trunc(DaySpan(val1, val2)) to achieve the
same result, but I was just curious as to why this change was made
which so drastically changes the functionality of these calls.

Thanks,

-SG

--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.

Seth Grover
sethdgrover[at]gmail[dot]com



More information about the fpc-pascal mailing list