* * *

Author Topic: TIniWebSession issue with localized date time format  (Read 221 times)

mobilevil

  • New member
  • *
  • Posts: 30
    • http://www.kachun.com
TIniWebSession issue with localized date time format
« on: August 20, 2017, 04:21:56 pm »
Lazarus 1.8RC4.

I found that the iniwebsession is expiring all session on my PC so I traced around and found that the iniwebsession is not reading the date written by itself!

And I have confirmed that the standalone TMemIniFile object is using by system local setting to write the date. but it is not able to read it back.

in my system it is written like this
[Session]
Start=20/Aug/17 20:40:33

TIniWebSession is created by TMyIniSessionFactory on the fly, and the TMemInifile used by TIniWebSession is protected. I don't see a way to modify the date time format used by the TMemInifile.

so I copied the iniwebsession.pas to Myiniwebsession.pas, renamed both TIniWebSession TIniSessionFactory to TMyIniWebSession TMyIniSessionFactory, and changed WriteDateTime to WriteFloat.

Now sessions work in my system no matter how I set the locale. My ini file looks like this now.

[Session]
Start=42967.8969842245
Timeout=60
Last=42967.9016720833

I understand that iniwebsession is provided as a simple starting point but it is quite frustrating to have a loose starting point. I think we should
1:modify iniwebsession so that it specify it's own fixed date time format.
or,
2:modify TInifile or DateTime format APIs so that it recognize  what it wrote by default.


 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus