[fpc-pascal] Re: daysbetween

Seth Grover sethdgrover at gmail.com
Wed May 6 23:06:23 CEST 2009


Disregard my email about daysbetween, I just saw this:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/objpas/dateutil.inc?view=diff&r1=12958&r2=13107

-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



On Wed, May 6, 2009 at 2:11 PM, Seth Grover <sethdgrover at gmail.com> wrote:
> 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