View Issue Details

IDProjectCategoryView StatusLast Update
0015474LazarusRTLpublic2010-10-31 23:19
ReporterSven BarthAssigned ToVincent Snijders 
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Platformi386OSLinuxOS Version2.6.31
Product VersionProduct Build 
Target VersionFixed in Version0.9.29 (SVN) 
Summary0015474: TDate and TTime are not defined in unit System
DescriptionDelphi supports the types TDate and TTime declared in System unit, while in Free Pascal they are only supported through Lazarus' Controls unit (and for non Lazarus projects, that is too much dependency ;) ).
Additional InformationAttached patch adds these types after declaration of TDateTime in systemh.inc.

I didn't touch PDate (defined around line 350 in systemh.inc), though, because I don't know if that would change/break something.

Note: The corresponding types in Lazarus' Controls unit might now be conditionally removed, but I don't know the correct compiler version defines for this ;)
TagsNo tags attached.
Fixed in Revision27838
LazTarget-
Widgetset
Attached Files
  • tdate-ttime.patch (425 bytes)
    Index: rtl/inc/systemh.inc
    ===================================================================
    --- rtl/inc/systemh.inc	(Revision 14516)
    +++ rtl/inc/systemh.inc	(Arbeitskopie)
    @@ -300,6 +300,8 @@
       HRESULT             = type Longint;
     {$ifndef FPUNONE}
       TDateTime           = type Double;
    +  TDate               = type TDateTime;
    +  TTime               = type TDateTime;
     {$endif}
       TError               = type Longint;
     
    
    tdate-ttime.patch (425 bytes)
  • laz-ttime-tdate.patch (420 bytes)
    diff --git a/lcl/controls.pp b/lcl/controls.pp
    index 0bf8174..220111e 100644
    --- a/lcl/controls.pp
    +++ b/lcl/controls.pp
    @@ -74,8 +74,10 @@ type
       TWinControlClass = class of TWinControl;
       TControlClass = class of TControl;
     
    +{$if (FPC_VERSION <= 2) and (FPC_RELEASE < 5)}
       TDate = type TDateTime;
       TTime = type TDateTime;
    +{$endif}
     
       // ToDo: move this to a message definition unit
       TCMMouseWheel = record
    
    laz-ttime-tdate.patch (420 bytes)
  • lazarus-tdate-ttime.patch (541 bytes)
    Index: lcl/controls.pp
    ===================================================================
    --- lcl/controls.pp	(Revision 27235)
    +++ lcl/controls.pp	(Arbeitskopie)
    @@ -74,10 +74,10 @@
       TWinControlClass = class of TWinControl;
       TControlClass = class of TControl;
     
    -//{$if (FPC_VERSION <= 2) and (FPC_RELEASE < 5)}
    +{$if (FPC_VERSION <= 2) and (FPC_RELEASE <= 4) and (FPC_PATCH < 2)}
       TDate = type TDateTime;
       TTime = type TDateTime;
    -//{$endif}
    +{$endif}
     
       // ToDo: move this to a message definition unit
       TCMMouseWheel = record
    

Relationships

parent of 0015483 closedMarco van de Voort FPC RTL: TTime is Object Pascal type but not Unix-system type 

Activities

2010-01-06 17:00

 

tdate-ttime.patch (425 bytes)
Index: rtl/inc/systemh.inc
===================================================================
--- rtl/inc/systemh.inc	(Revision 14516)
+++ rtl/inc/systemh.inc	(Arbeitskopie)
@@ -300,6 +300,8 @@
   HRESULT             = type Longint;
 {$ifndef FPUNONE}
   TDateTime           = type Double;
+  TDate               = type TDateTime;
+  TTime               = type TDateTime;
 {$endif}
   TError               = type Longint;
 
tdate-ttime.patch (425 bytes)

Florian

2010-01-07 11:26

administrator   ~0033483

Accoding to the Delphi help, they are defined as double: http://docwiki.embarcadero.com/VCL/en/System.TTime ?

Sven Barth

2010-01-07 15:22

manager   ~0033489

Did that change from 2009 to 2010? Because in Delphi 2009 Online Help it is "type TDateTime": http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/System_TDate.html

Florian

2010-01-07 15:45

administrator   ~0033491

Since it seems to be rather new, D2007 doesn't have it: http://docs.embarcadero.com/products/rad_studio/radstudio2007/RS2007_helpupdates/HUpdate4/EN/html/delphivclwin32/!!TYPES_System.html I propose to use the D2010 declaration.

Sven Barth

2010-01-08 09:25

manager   ~0033506

It's not that new... at work we use Delphi 6 and they are already defined there (but I don't know where)

The D2010 declaration is the one with Double? Then I'll update my patch if you want.

Florian

2010-01-08 10:57

administrator   ~0033511

I added it in r14573 like lazarus has it. I move the report to the lazarus project so they can the system unit defines in future versions of lazarus.

Jonas Maebe

2010-01-08 15:51

reporter   ~0033514

There's a problem with this change: the unix platforms already defined a TTime type in ptype.inc (linux/ptype.inc, darwin/ptype.inc, ...). The system unit now no longer compiles on Unix platforms. This can be worked around by adding {$ifndef FPC_IS_SYSTEM} around the TTime definition in ptype, but
a) this still needs checking to make sure the the original Unix TTime definition is not used anywhere in declarations of unix routines used in the system unit
b) it still makes the unixtype and unix units hide the system.ttime definition if either is used in a program

I don't know the best solution.

Sven Barth

2010-01-08 21:44

manager   ~0033521

May I ask why these aliases were defined in the first place? For Kylix compatibility?

The solution proposed in 0015483 simply removes this Unix TTime alias in all RTL units and one packages unit. It solves your mentioned problems, but introduces a new one if one uses the Unix TTime in his/her own code. But this should in theory be catched by the compiler.

It might not be the best solution either, but it reduces the problem to compiler errors in user code instead of strangs errors at Runtime inside RTL

Sven Barth

2010-01-14 19:39

manager   ~0033629

I'm proposing a patch for Lazarus' controls.pp here, that might be applied once TDate and TTime are enabled again.

2010-01-14 19:39

 

laz-ttime-tdate.patch (420 bytes)
diff --git a/lcl/controls.pp b/lcl/controls.pp
index 0bf8174..220111e 100644
--- a/lcl/controls.pp
+++ b/lcl/controls.pp
@@ -74,8 +74,10 @@ type
   TWinControlClass = class of TWinControl;
   TControlClass = class of TControl;
 
+{$if (FPC_VERSION <= 2) and (FPC_RELEASE < 5)}
   TDate = type TDateTime;
   TTime = type TDateTime;
+{$endif}
 
   // ToDo: move this to a message definition unit
   TCMMouseWheel = record
laz-ttime-tdate.patch (420 bytes)

Paul Ishenin

2010-04-19 10:21

manager   ~0036814

Thanks, applied. Please close if ok.

Sven Barth

2010-04-20 18:59

manager   ~0036851

Not good. You should revert this as fast as possible, cause the TDate and TTime types are not yet enabled again in systemh.inc!

Regards,
Sven

Vincent Snijders

2010-04-20 19:47

manager   ~0036853

What bug report enable TDate and TTime?

Sven Barth

2010-04-20 21:01

manager   ~0036855

Well... they were disabled in the related issue 0015483, but it appears noone enabled them again, after that bug was fixed... (I didn't realize until I read some hours ago that Paul committed my patch).

But to answer your question: Shall I open an extra report for this, or would you consider this issue here to be the correct one (as this was the one TDate and TTime were included with).

Regards,
Sven

Vincent Snijders

2010-04-20 21:17

manager   ~0036858

I don't see much difference, I just want to make it visible we cannot resolve this one, because there is still a pending fpc issue on which it depends. As it is now, it seems that the fpc side of things are resolved (even closed), so all that needs to be done is to make the change on the lazarus side.

So we either need a new or an existing issue to make it a child issue. Maybe best is to open a new issue, because 0015483 is already closed.

Paul Ishenin

2010-04-21 04:03

manager   ~0036863

Ok, I returned back TDate and TTime.

Sven Barth

2010-04-21 12:38

manager   ~0036874

@Paul: Thanks for reverting, but I don't think it's correct to resolve this issue...

@Vincent: You seem to confuse things a bit. This issue (0015474) was the original FPC issue, which added TDate and TTime to systemh.inc. Florian applied my patch and moved that issue to Lazarus to adjust the controls.pp unit.
Then issue 0015483 came up, cause I didn't realize that there is a TTime already defined in the Unix units. This issue was resolved and while solving it the TTime and TDate types were disabled again (which I also didn't realize up until yesterday). After that I had put up a patch for controls.pp and waited.

So in theory this IS the FPC report, it was only changed to Lazarus, because Florian thought the issue was resolved (for FPC) which it wasn't.

Nevertheless: I haved opened a new report for the disabled types.

Regards,
Sven

Vincent Snijders

2010-04-21 16:26

manager   ~0036885

I see, moving the report was maybe not a good idea as it was trying to fix two things in two projects.

Zoran Vučenović

2010-04-21 18:17

developer   ~0036890

In Delphi 6 and Delphi 7 they are declared in Controls unit only, as "type TDateTime"

http://docs.embarcadero.com/products/rad_studio/radstudio2007/RS2007_helpupdates/HUpdate4/EN/html/delphivclwin32/!!TYPES_Controls.html

Sven Barth

2010-04-22 09:10

manager   ~0036906

@Zoran: The two types were already added in System unit (due to this issue), because that is where they are defined in at least Delphi 2009 and 2010. The problem is that they are currently not enabled, because of a type conflict we found with one of the Unix types, which was resolved.

Currently they need to be conditionally removed from controls.pp once the two declarations are available again.

Regards,
Sven

Marco van de Voort

2010-05-10 20:32

manager   ~0037423

Note that I would like to know for sure that D2010 defines them as Double, to exclude problems with Embarcadero's documentation tooling.

Marco van de Voort

2010-05-19 10:27

manager   ~0037763

Reenabled ttime/tdate in systemh, now the unix related problems are long solved ( 0016307 )

Could this be tested short term? Then the relevant changes can be merged to 2.4.2

Sven Barth

2010-05-19 13:23

manager   ~0037771

What kind of tests do you have in mind?

Regards,
Sven

Sven Barth

2010-08-29 19:27

manager   ~0040608

Last edited: 2010-08-29 19:29

I'm uploading a new patch for controls.pp which includes a new compiler condition. The TDate and TTime types are now disabled for all compilers starting from 2.4.2 (and thus enabled for all compilers below that).

Regards,
Sven

2010-08-29 19:28

 

lazarus-tdate-ttime.patch (541 bytes)
Index: lcl/controls.pp
===================================================================
--- lcl/controls.pp	(Revision 27235)
+++ lcl/controls.pp	(Arbeitskopie)
@@ -74,10 +74,10 @@
   TWinControlClass = class of TWinControl;
   TControlClass = class of TControl;
 
-//{$if (FPC_VERSION <= 2) and (FPC_RELEASE < 5)}
+{$if (FPC_VERSION <= 2) and (FPC_RELEASE <= 4) and (FPC_PATCH < 2)}
   TDate = type TDateTime;
   TTime = type TDateTime;
-//{$endif}
+{$endif}
 
   // ToDo: move this to a message definition unit
   TCMMouseWheel = record

Sven Barth

2010-10-24 11:04

manager   ~0042042

The patch from 29th August works as expected with 2.4.2rc1. So this could be targeted for 0.9.30. :)

Regards,
Sven

Sven Barth

2010-10-31 23:19

manager   ~0042518

Thanks for applying.

Regards,
Sven

Issue History

Date Modified Username Field Change
2010-01-06 17:00 Sven Barth New Issue
2010-01-06 17:00 Sven Barth File Added: tdate-ttime.patch
2010-01-07 11:26 Florian Note Added: 0033483
2010-01-07 15:22 Sven Barth Note Added: 0033489
2010-01-07 15:45 Florian Note Added: 0033491
2010-01-08 09:25 Sven Barth Note Added: 0033506
2010-01-08 10:57 Florian Note Added: 0033511
2010-01-08 10:58 Florian Project FPC => Lazarus
2010-01-08 15:51 Jonas Maebe Note Added: 0033514
2010-01-08 19:42 Jonas Maebe Relationship added parent of 0015483
2010-01-08 21:44 Sven Barth Note Added: 0033521
2010-01-14 19:39 Sven Barth Note Added: 0033629
2010-01-14 19:39 Sven Barth File Added: laz-ttime-tdate.patch
2010-03-12 13:31 Vincent Snijders LazTarget => 0.9.30
2010-03-12 13:31 Vincent Snijders Status new => acknowledged
2010-03-12 13:31 Vincent Snijders Target Version => 0.9.30
2010-04-19 10:21 Paul Ishenin Fixed in Revision => 24714
2010-04-19 10:21 Paul Ishenin Status acknowledged => resolved
2010-04-19 10:21 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2010-04-19 10:21 Paul Ishenin Resolution open => fixed
2010-04-19 10:21 Paul Ishenin Assigned To => Paul Ishenin
2010-04-19 10:21 Paul Ishenin Note Added: 0036814
2010-04-20 18:59 Sven Barth Status resolved => assigned
2010-04-20 18:59 Sven Barth Resolution fixed => reopened
2010-04-20 18:59 Sven Barth Note Added: 0036851
2010-04-20 19:47 Vincent Snijders Note Added: 0036853
2010-04-20 19:48 Vincent Snijders Status assigned => feedback
2010-04-20 21:01 Sven Barth Note Added: 0036855
2010-04-20 21:17 Vincent Snijders Note Added: 0036858
2010-04-21 04:03 Paul Ishenin Fixed in Revision 24714 => 24714,24778
2010-04-21 04:03 Paul Ishenin Status feedback => resolved
2010-04-21 04:03 Paul Ishenin Resolution reopened => fixed
2010-04-21 04:03 Paul Ishenin Note Added: 0036863
2010-04-21 12:38 Sven Barth Status resolved => assigned
2010-04-21 12:38 Sven Barth Resolution fixed => reopened
2010-04-21 12:38 Sven Barth Note Added: 0036874
2010-04-21 13:03 Paul Ishenin Fixed in Revision 24714,24778 =>
2010-04-21 13:03 Paul Ishenin LazTarget 0.9.30 => -
2010-04-21 13:03 Paul Ishenin Status assigned => acknowledged
2010-04-21 13:03 Paul Ishenin Product Version 2.5.1 =>
2010-04-21 13:03 Paul Ishenin Fixed in Version 0.9.29 (SVN) =>
2010-04-21 13:03 Paul Ishenin Target Version 0.9.30 =>
2010-04-21 13:04 Paul Ishenin Assigned To Paul Ishenin =>
2010-04-21 16:26 Vincent Snijders Note Added: 0036885
2010-04-21 18:17 Zoran Vučenović Note Added: 0036890
2010-04-22 09:10 Sven Barth Note Added: 0036906
2010-05-10 20:32 Marco van de Voort Note Added: 0037423
2010-05-19 10:27 Marco van de Voort Note Added: 0037763
2010-05-19 13:23 Sven Barth Note Added: 0037771
2010-08-29 19:27 Sven Barth Note Added: 0040608
2010-08-29 19:28 Sven Barth File Added: lazarus-tdate-ttime.patch
2010-08-29 19:29 Sven Barth Note Edited: 0040608
2010-08-29 19:29 Sven Barth Note Edited: 0040608
2010-10-24 11:04 Sven Barth Note Added: 0042042
2010-10-24 21:39 Vincent Snijders Fixed in Revision => 27838
2010-10-24 21:39 Vincent Snijders Status acknowledged => resolved
2010-10-24 21:39 Vincent Snijders Fixed in Version => 0.9.29 (SVN)
2010-10-24 21:39 Vincent Snijders Resolution reopened => fixed
2010-10-24 21:39 Vincent Snijders Assigned To => Vincent Snijders
2010-10-31 23:19 Sven Barth Status resolved => closed
2010-10-31 23:19 Sven Barth Note Added: 0042518