Re: [Lazarus] Debugging Wince shows NO debugger output

2013-11-14 Thread Sven Barth

Am 13.11.2013 22:49, schrieb Martin:

On 13/11/2013 20:40, GREP wrote:

Hi
I could not get the breakpoints to work, I googled a lot, tried all the
suggestions
unsuccessfully.
After a full day of trial I ended up that now the project does not show
anything in the Debugger output window.

I have this setup
Windows XP, lazarus 1.0,12, svn 42478



Not sure, never done wince.

But you can try and sent a log 
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session


Maybe something stands out.
I mention this as something that stands out for quite some time already: 
http://bugs.freepascal.org/view.php?id=21061


Regards,
Sven

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Debugging Wince shows NO debugger output

2013-11-14 Thread Sven Barth

Am 13.11.2013 21:40, schrieb GREP:

Hi
I could not get the breakpoints to work, I googled a lot, tried all the
suggestions
unsuccessfully.
Did you find this bug report 
http://bugs.freepascal.org/view.php?id=21061 on your search? (and also 
the related ones)


Regards,
Sven

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus 1.2RC1 Ctrl-F9 not working

2013-11-14 Thread Henry Vermaak
On Wed, Nov 13, 2013 at 11:17:59PM +0100, Bart wrote:
 On 11/13/13, Mattias Gaertner nc-gaert...@netcologne.de wrote:
 
  Check your short cuts in your system settings. They take precedence
  over any normal application like the IDE.
 
 On my Fedora 18 / KDE Ctrl+F9 does something weird to the windows that
 I cannot really describe or give a name.
 I'm too lazy to look it up and disable it.
 
 (On my old Suse 10.0 disabling system setting for Ctrl+F9 took me 2
 days to find...)

In case anyone is struggling to find it in XFCE: Settings-Window
Manager-Keyboard.  Disable the shortcut for Workspace 9.

Henry

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Reimar Grabowski
On Thu, 14 Nov 2013 07:19:56 +0100
Jürgen Hestermann juergen.hesterm...@gmx.de wrote:

 Am 2013-11-13 19:42, schrieb Reimar Grabowski:
   1 julian year = 365.25 days of 86400 SI seconds each.
   Of course there are lots of other definitions for year but if FPC uses the 
 julian one the value is exact and no approximation
 
 
 So the difference between 2007-01-01 12:00 and 2008-01-01 12:00 ist *not* one 
 year?
It is not one julian year. There is nothing like a year. As i said there are 
different definitions. If you talk about calendar year it's length changes and 
is therefor not a good measure of time and not used in science.

 It's only 365,00 days and therefore not a full year according to your 
 definition.
Correct. And this is not my definition it is the correct definition of a julian 
year and it is based on SI units. Time is measured in SI seconds. If you cannot 
express 'your year' as seconds it is not a unit of time.

 But this it totaly wrong.
Care to elaborate? Or is it just your gut feeling?

 Same day same time of one year and the next should always be a one year 
 difference.
According to what definition of year? Calendar year is a rather poor unit to 
measure time differences as it is not constant and cannot be expressed in 
seconds.

R.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Reimar Grabowski
On Thu, 14 Nov 2013 07:56:16 +0100
Patrick Chevalley p...@ap-i.net wrote:

 All this efforts are to bypass the problem with the calendar year (the 
 one you mention) because it is sometime 365 and sometime 366 days. This 
 is a totally unacceptable definition when you need an homogeneous time 
 scale.
 
 So all depend of the use you need for your application  and it must be 
 admitted that one set of definition/function is not sufficient and every 
 one must be careful when using time period.
+1

R.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Reimar Grabowski
On Wed, 13 Nov 2013 20:34:36 +0100
John Landmesser joh...@online.de wrote:

 What about Databases like mysql, Oracle, Firebird. I'm shure they have 
 such a function.

For MySQL:

DATEDIFF(expr1,expr2)

DATEDIFF() returns expr1 – expr2 expressed as a value in days from one
date to the other. expr1 and expr2 are date or date-and-time
expressions. Only the date parts of the values are used in the
calculation.

:)

R.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread José Mejuto

El 14/11/2013 7:56, Patrick Chevalley escribió:


All this efforts are to bypass the problem with the calendar year (the
one you mention) because it is sometime 365 and sometime 366 days. This
is a totally unacceptable definition when you need an homogeneous time
scale.


Hello,

I was following this thread about the years, months, days, datediff and 
almost all people expect that dates:


2013/05/15 - 2013/07/16

Return 2 months + 1 day, but I expect it to return 1 month and 16+16 
days, because month definition out of context is around 30.43 So in 
the above example for sure 1 months has been passed and 32 days, then 
you can decide if 32 days is 1 month plus or not.


The same applies to years:

1999/02/28 - 2000/02/29 = 1 Year
2000/02/27 - 2001/02/28 = 1 Year + 1 day
2000/02/28 - 2001/02/28 = 1 Year
2000/02/29 - 2001/02/28 = 1 Year
2000/02/29 - 2001/03/01 = 1 Year + 1 day

2001/05/2 - 2002/06/30 = 1 Year + 29+30 days

Maybe I'm completly wrong ?

--


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread John Landmesser

On 14.11.2013 10:50, Reimar Grabowski wrote:

For MySQL:

DATEDIFF(expr1,expr2)

DATEDIFF() returns expr1 – expr2 expressed as a value in days from one
date to the other. expr1 and expr2 are date or date-and-time
expressions. Only the date parts of the values are used in the
calculation.

:)

R.


... be carefull!

Databases as MySQL or FirebIrd or Oracle have a buildin function 
DateDiff, but the result is different!!


Our function delivers the age of a person in years, months, days.

The other datediff function delivers years OR month OR days.

So you can't use them to calculate the age of a person for example!!

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread waldo kitty

On 11/14/2013 4:41 AM, Reimar Grabowski wrote:

On Thu, 14 Nov 2013 07:19:56 +0100
Jürgen Hestermann juergen.hesterm...@gmx.de wrote:


Am 2013-11-13 19:42, schrieb Reimar Grabowski:
   1 julian year = 365.25 days of 86400 SI seconds each.
   Of course there are lots of other definitions for year but if FPC uses
   the julian one the value is exact and no approximation


So the difference between 2007-01-01 12:00 and 2008-01-01 12:00 ist *not*
one year?

It is not one julian year. There is nothing like a year. As i said there
are different definitions. If you talk about calendar year it's length
changes and is therefor not a good measure of time and not used in science.


right but this whole thread was started because someone wanted a calendar based 
datediff function which returns years, months and days... granted, they could 
have used SI units of 86400 sec/day and 365.25 day's per year (30.4375 
days/month) to calculate the difference between their ending date and the 
current date in a continuous calculation but then looking at the calendar and 
counting the ones they could see would be different...


start: 14 Nov 2013
end:   01 Aug 2018

days:  1721

1721 / 365.25 = 4.7118412047 years = 4 years
0.7118412047 * 365.25 = 260 days
260 / 30.4375 = 8.5420944559 months = 8 months
0.5420944559 = 30.4375 = 16.5 days

(trunc) 4 years, 8 months, 16 days
OR
(round) 4 years, 8 months, 17 days

FWIW: the routine we've been working on (with bug fix modifications) returns the 
same output as the above (from openoffice calc)...


2013-11-14 to 2018-08-01 is4 yrs8 mos   17 days

yay! :lol:


It's only 365,00 days and therefore not a full year according to your
definition.

Correct. And this is not my definition it is the correct definition of a
julian year and it is based on SI units. Time is measured in SI seconds. If
you cannot express 'your year' as seconds it is not a unit of time.


by who's definition of time? ;) O:)


But this it totaly wrong.

Care to elaborate? Or is it just your gut feeling?


Same day same time of one year and the next should always be a one year
difference.

According to what definition of year? Calendar year is a rather poor unit to
measure time differences as it is not constant and cannot be expressed in
seconds.


actually, it can be but depending on the frame reference used, it is either 
fractions or the count varies ;)


so far we have determined in this thread that there are at least four basic sets 
of routines...


  calendar inclusive
  calendar exclusive
  fixed inclusive  (existing *Span routines)
  fixed exclusive  (existing *Between routines)

inclusive: includes the first and last days of the period in the count. used in 
(eg) rent and age calculations.

  eg: Mon 01 Jul 2013 - Fri 05 Jul 2013 = 5 day work week
  Mon 01 Jul 2013 - Sun 07 Jul 2013 = 7 day (1 week) rental

exclusive: does not count the last day of the period. used in (eg) financial 
calculations.

  eg: Mon 01 Jul 2013 - Mon 08 Jul 2013 = 7 days

calendar: the difference between the date in one year and the same date in the 
next or previous year is 1 year... the same with days in months... the 10th is 
one month from the 10th of the previous month and one month from the 10th in the 
next month no matter how many days there are in the months involved...


fixed: SI oriented counting of the length of years, months and days using 
specific values for each...


  The average length of a year in days is:
346.62: a draconitic year
353,
354,
355   : common years in some lunisolar calendars
354.37: average length of a year in lunar calendars
365   : a vague year and a common year in many solar calendars
365.24219 : mean tropical year (rounded to 5 places) for epoch 2000
365.2424  : vernal equinox year (rounded to 4 places) for epoch 2000
365.2425  : average length of a year in the Gregorian calendar
365.25: the average length of a year in the Julian calendar
365.25636 : mean solar year
365.2564  : a sidereal year
365.25689 : a Gaussian year
366   : a leap year in many solar calendars
383,
384
385   : leap years in some lunisolar calendars.
383.9 : leap year in some lunisolar calendars.

Astronomical years count the Julian year as a unit of time, defined as 365.25 
days of 86400 SI seconds each with no leap seconds.


A calendar year is an approximation of the Earth's orbital period in a given 
calendar. Gregorian calendar years (as well as in the Julian calendar) has 
either 365 (common years) or 366 (leap years) days.


An average Gregorian year is 365.2425 days = 52.1775 weeks = 8765.82 hours = 
525949.2 minutes = 31556952 seconds (mean solar, not SI).


A common year is 365 days = 8760 hours = 525600 minutes = 31536000 seconds.

A leap year is 366 days = 8784 hours = 527040 minutes = 31622400 seconds.

The 400-year cycle of the Gregorian calendar has 146097 days and hence exactly 
20871 weeks.





Re: [Lazarus] DateDif function needed

2013-11-14 Thread waldo kitty

On 11/14/2013 4:50 AM, Reimar Grabowski wrote:

On Wed, 13 Nov 2013 20:34:36 +0100
John Landmesser joh...@online.de wrote:


What about Databases like mysql, Oracle, Firebird. I'm shure they have
such a function.


For MySQL:

DATEDIFF(expr1,expr2)

DATEDIFF() returns expr1 – expr2 expressed as a value in days from one
date to the other. expr1 and expr2 are date or date-and-time
expressions. Only the date parts of the values are used in the
calculation.


same thing as openOffice Calc... then, as i mention in my other post in this 
thread, one has to figure out how to count the years and months which will use 
either estimations (decimal fractions) or variants (actual numbers of days per 
month and year)... the big decision is which one to use for whatever accuracy is 
desired O:)


--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Mattias Gaertner
On Thu, 14 Nov 2013 13:48:46 +0100
John Landmesser joh...@online.de wrote:

[...]
 Our function delivers the age of a person in years, months, days.

What is your diff between 31th Jan and 30 March 2013?

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread waldo kitty

On 11/14/2013 7:25 AM, José Mejuto wrote:

Maybe I'm completly wrong ?


you are completely right, IMHO... one simply needs to choose their desired base 
and level of error that is acceptable for their task's needs...



the initial problem arose because there's no easy way to calc the desired output 
with the existing routines and a lot of dancing about... spreadsheets and other 
languages are in the same boat, too, with the routines they offer...


eg: openOffice Calc - no easy way to retain only the fraction of a result so one 
must dance with subtracting and truncating all the while recalculating the 
values over and over again... one can elect to use some scratchpad area on the 
sheet to store some intermittent values...


witness: these formulas from Calc using fractional estimations like existing 
routines in FPc/Lazarus


[without scratchpad]
total days:   =DAYS(A2;B2)
whole years:  =INT(C2/365.25) [C2 holds total days value]
whole months: =INTC2/365.25)-TRUNC(C2/365.25))*365.25)/30.4375)
whole days: 
=ROUND((C2/365.25)-TRUNC(C2/365.25))*365.25)/30.4375)-TRUNC(C2/365.25)-TRUNC(C2/365.25))*365.25)/30.4375)))*30.4375)



[with scratchpad]
end date: 08/01/2018   [MM/DD/ in A2]
start date:   11/14/2013   [MM/DD/ in B2]
days between: =DAYS(A2;B2)[in C2] 1721
real years:   =C2/365.25 [in AD2] 4.7118412047
int years:=INT(AD2)   [in D3] 4
real months:  =((AD2-TRUNC(AD2))*365.25)/30.4375 [in AE2] 8.5420944559
int  months:  =INT(AE2)   [in E2] 8
real days:=((AE2)-TRUNC(AE2))*30.4375[in AF2] 16.5
int days: =ROUND(AF2) [in F2] 17



--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread John Landmesser

On 14.11.2013 14:16, Mattias Gaertner wrote:

On Thu, 14 Nov 2013 13:48:46 +0100
John Landmesser joh...@online.de wrote:


[...]
Our function delivers the age of a person in years, months, days.

What is your diff between 31th Jan and 30 March 2013?

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

answer:
Jedi DateDiff: 0 Year, 1 month,  30 days


It's really difficult according to waldo kitty's post: today 14:10

*

Hihi, i asked a question about a DateDiff function for FreePascal, 
because i wanted to know: how many years, month, days left to work in 
Office until my pension begins on 01.08.2018.


.. and where are we now??

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Junior

Frankly, this list from time to time ...

Em 14-11-2013 11:10, John Landmesser escreveu:

On 14.11.2013 14:16, Mattias Gaertner wrote:

On Thu, 14 Nov 2013 13:48:46 +0100
John Landmesser joh...@online.de wrote:


[...]
Our function delivers the age of a person in years, months, days.

What is your diff between 31th Jan and 30 March 2013?

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

answer:
Jedi DateDiff: 0 Year, 1 month,  30 days


It's really difficult according to waldo kitty's post: today 14:10

*

Hihi, i asked a question about a DateDiff function for FreePascal, 
because i wanted to know: how many years, month, days left to work in 
Office until my pension begins on 01.08.2018.


.. and where are we now??

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Michael Schnell

On 11/14/2013 03:46 PM, Frederic Da Vitoria wrote:



.. and where are we now??


Right in the middle of a very interesting discussion :-)



-1

-Michael
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread waldo kitty

On 11/14/2013 8:16 AM, Mattias Gaertner wrote:

On Thu, 14 Nov 2013 13:48:46 +0100
John Landmesser joh...@online.de wrote:


[...]
Our function delivers the age of a person in years, months, days.


What is your diff between 31th Jan and 30 March 2013?


the one i am currently testing returns

  2013-01-31 to 2013-03-30 is0 yrs1 mos   30 days


FWTW, too ;)

leapyear:
  2012-01-31 to 2012-03-30 is0 yrs1 mos   30 days

non-leapyear to leapyear:
  2011-01-31 to 2012-03-30 is1 yrs1 mos   30 days

leapyear to non-leapyear:
  2012-01-31 to 2013-03-30 is1 yrs1 mos   30 days

non-leapyear thru leapyear to non-leapyear:
  2011-01-31 to 2013-03-30 is2 yrs1 mos   30 days

leapyear thru non-leapyear to non-leapyear:
  2012-01-31 to 2014-03-30 is2 yrs1 mos   30 days


the whole of Feb is counted as a month no matter how many days it has...

--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Hans-Peter Diettrich

John Landmesser schrieb:

Hihi, i asked a question about a DateDiff function for FreePascal, 
because i wanted to know: how many years, month, days left to work in 
Office until my pension begins on 01.08.2018.


What do you consider as *one* year, month etc., fixed (average) values 
or calender values?


When you get numbers for the years, months etc. remaining, and you 
reduce the number of days every day, what would you do when reaching 
zero days? You decrease months by one, and reset days to *which* amount?



.. and where are we now??


Still before your answer.

DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Frederic Da Vitoria
2013/11/14 Michael Schnell mschn...@lumino.de

  On 11/14/2013 03:46 PM, Frederic Da Vitoria wrote:

   .. and where are we now??


  Right in the middle of a very interesting discussion :-)


 -1


Well, everyone is entitled to his opinions, right, else we would all be
doing C :-)

-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Frederic Da Vitoria
2013/11/14 John Landmesser joh...@online.de

 Hihi, i asked a question about a DateDiff function for FreePascal, because
 i wanted to know: how many years, month, days left to work in Office until
 my pension begins on 01.08.2018.

 .. and where are we now??


Right in the middle of a very interesting discussion :-)

-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Bart
On 11/14/13, waldo kitty wkitt...@windstream.net wrote:

 you are completely right, IMHO... one simply needs to choose their desired
 base
 and level of error that is acceptable for their task's needs...

It's all about definition.
For me I would think that given today is the last day of a given
month, then today + 1 month = the same date on in the next month, or
if the next month has fewer day, the last day of the next month.
So
- april 30th + 1 month = may 30th
- march 31st + 1 month = may 30th (not june 1st)
Yet all of our tools (includimg mine) say march 31st to april 30th =
0 months + 30 days...

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread Jürgen Hestermann

Am 2013-11-14 07:56, schrieb Patrick Chevalley:
 So the difference between 2007-01-01 12:00 and 2008-01-01 12:00 ist *not* 
one year?
 No, the base definition of the year is not a digit change,
 but the time it take to the Earth to return at the same point of its orbit 
around the Sun.

Well, *this* value (earth at the same point) is also varying. When doing 
astronomical calculations I would definitely not use a fixed value.


 The julian year of 365.25 is a convenient approximation still in use despite 
the julian calendar was abrogated some 400 years ago.

Of what use would it be to use 365.25 days as a representation of a year? You can also 
use 400 instead. It would be just an arbitrary definition decoupled from calendars. You 
cannot calculate anything useful with it. Neither calendar dates nor astronomical things. 
It is just an accademic value and exists only because it is so easy to use.


 All this efforts are to bypass the problem with the calendar year (the one 
you mention) because it is sometime 365 and sometime 366 days. This is a totally 
unacceptable definition when you need an homogeneous time scale.

Well, that's just the whole point of this thread: The time scale we are talking 
about here is *not* homogeneous! Instead, a synchronization with calendar dates 
is wanted/needed. That has always been a problem with calendar definitons. The 
rotation of earth around the sun is not a whole-numbered multiple of its 
rotation around itself but we want a whole number of days (otherwise day time 
would no longer be related to sunlight). So we synchronize our calendar with 
the run of the sun by leap days (and leap seconds). But now years and months 
are no longer a fixed value. Therefore differences must be calculated in a more 
complex way based on dates and not as a fixed number of (milli)seconds. It's 
easy to use fixed values for day, month, year but it is of no use when talking 
about calendars.


 So all depend of the use you need for your application  and it must be 
admitted that one set of definition/function is not sufficient and every one must 
be careful when using time period.

Just give me an example where a fixed value for a month is of use? If you rent 
an appartement you will definitely not be able to insist on your fixed 
definition of a month (i.e., when starting on february the 1st). In daily usage 
the time ranges vary depending on the month you look at.


 For me the very simple functions as implemented if FPC are sufficient,

In what context do you use these functions?


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread waldo kitty

On 11/14/2013 12:26 PM, Bart wrote:

On 11/14/13, waldo kitty wkitt...@windstream.net wrote:


you are completely right, IMHO... one simply needs to choose their desired
base and level of error that is acceptable for their task's needs...


It's all about definition.


right... that's what i meant by desired base... eg: calendar, SI notation, 
Julian, Gregorian, etc...)



For me I would think that given today is the last day of a given
month, then today + 1 month = the same date on in the next month,


agreed...


or if the next month has fewer day, the last day of the next month.


yeah... i'm undecided on that :? (** below) my current code returns the 
following...

2012-01-29 to 2012-02-29 is 0 yrs 1 mos 0 days
2012-01-29 to 2012-03-01 is 0 yrs 1 mos 3 days
2012-01-29 to 2012-03-31 is 0 yrs 2 mos 2 days
2012-01-29 to 2012-04-30 is 0 yrs 3 mos 1 days
2012-01-29 to 2012-05-31 is 0 yrs 4 mos 2 days
2012-01-29 to 2012-06-30 is 0 yrs 5 mos 1 days
2012-01-29 to 2012-07-31 is 0 yrs 6 mos 2 days
2012-01-29 to 2012-08-31 is 0 yrs 7 mos 2 days
2012-01-29 to 2012-09-30 is 0 yrs 8 mos 1 days
2012-01-29 to 2012-10-31 is 0 yrs 9 mos 2 days
2012-01-29 to 2012-11-30 is 0 yrs 10 mos 1 days
2012-01-29 to 2012-12-31 is 0 yrs 11 mos 2 days

2012-01-31 to 2012-02-29 is 0 yrs 0 mos 29 days**
2012-01-31 to 2012-03-01 is 0 yrs 1 mos 1 days
2012-01-31 to 2012-03-31 is 0 yrs 2 mos 0 days
2012-01-31 to 2012-04-30 is 0 yrs 2 mos 30 days**
2012-01-31 to 2012-05-31 is 0 yrs 4 mos 0 days
2012-01-31 to 2012-06-30 is 0 yrs 4 mos 30 days**
2012-01-31 to 2012-07-31 is 0 yrs 6 mos 0 days
2012-01-31 to 2012-08-31 is 0 yrs 7 mos 0 days
2012-01-31 to 2012-09-30 is 0 yrs 7 mos 30 days**
2012-01-31 to 2012-10-31 is 0 yrs 9 mos 0 days
2012-01-31 to 2012-11-30 is 0 yrs 9 mos 30 days**
2012-01-31 to 2012-12-31 is 0 yrs 11 mos 0 days


So
- april 30th + 1 month = may 30th
- march 31st + 1 month = may 30th (not june 1st)
Yet all of our tools (includimg mine) say march 31st to april 30th =
0 months + 30 days...


i know what you mean ;) :)

--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-14 Thread waldo kitty

On 11/14/2013 12:48 PM, Jürgen Hestermann wrote:

Am 2013-11-14 07:56, schrieb Patrick Chevalley:
  So the difference between 2007-01-01 12:00 and 2008-01-01 12:00 ist
  *not* one year?
  No, the base definition of the year is not a digit change,
  but the time it take to the Earth to return at the same point of its orbit
  around the Sun.

Well, *this* value (earth at the same point) is also varying.


exactly! the earth does not travel in a perfect circle around the sun with the 
sun in a fixed central position... then there's the tilt of the earth and that 
the poles wobble around following the 25770 year equinox precession such that 
Deneb will be the north pole star instead of Polaris at some point in the future 
(AD1) :)



When doing astronomical calculations I would definitely not use a fixed value.


but many do use fixed fractional average numbers to make the math easier and 
they live with the small errors... witness my long posting earlier today with 
the charts of days per year values and the numerous year periods ;)



  The julian year of 365.25 is a convenient approximation still in use despite
  the julian calendar was abrogated some 400 years ago.

Of what use would it be to use 365.25 days as a representation of a year? You
can also use 400 instead. It would be just an arbitrary definition decoupled
from calendars. You cannot calculate anything useful with it. Neither calendar
dates nor astronomical things. It is just an accademic value and exists only
because it is so easy to use.


i can agree with this ;)


  All this efforts are to bypass the problem with the calendar year (the one
  you mention) because it is sometime 365 and sometime 366 days. This is a
  totally unacceptable definition when you need an homogeneous time scale.

Well, that's just the whole point of this thread: The time scale we are talking
about here is *not* homogeneous! Instead, a synchronization with calendar dates
is wanted/needed. That has always been a problem with calendar definitons. The
rotation of earth around the sun is not a whole-numbered multiple of its
rotation around itself but we want a whole number of days (otherwise day time
would no longer be related to sunlight). So we synchronize our calendar with the
run of the sun by leap days (and leap seconds). But now years and months are no
longer a fixed value. Therefore differences must be calculated in a more complex
way based on dates and not as a fixed number of (milli)seconds. It's easy to use
fixed values for day, month, year but it is of no use when talking about 
calendars.


i couldn't have said it better :)


  So all depend of the use you need for your application  and it must be
  admitted that one set of definition/function is not sufficient and every one
  must be careful when using time period.

Just give me an example where a fixed value for a month is of use? If you rent
an appartement you will definitely not be able to insist on your fixed
definition of a month (i.e., when starting on february the 1st). In daily usage
the time ranges vary depending on the month you look at.


one can see this in recurring billings... some are 30 billing periods whereas 
others are monthly based where the bill is due on the same day of each month... 
in the former case, the due date floats about in each successive month... the 
latter is always on the X day of the month... i much prefer monthly billing over 
30 day billing ;)



  For me the very simple functions as implemented if FPC are sufficient,

In what context do you use these functions?


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus