Re: [Lazarus] Now function - returning UTC?

2014-04-23 Thread Felipe Monteiro de Carvalho
On Wed, Apr 23, 2014 at 6:19 AM, Michael Schnell  wrote:
> IMHO, these functions would be better located in the FPC RTL, as they are
> more "general" than what the Lazarus library is about.
>
> Same might be true for UTF8 helper functions.

Some years ago when the units were created I offered to add them to
the RTL and they were rejected with the argumentation that the RTL
does not support UTF-8 and doesn't plan to. So that's why they are
located in LazUtils instead.

-- 
Felipe Monteiro de Carvalho

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


Re: [Lazarus] Now function - returning UTC?

2014-04-23 Thread Michael Schnell

On 04/21/2014 12:49 PM, Felipe Monteiro de Carvalho wrote:

On Sat, Apr 19, 2014 at 4:07 PM, Luca Olivetti  wrote:

BTW, the name of the unit isn't really meaningful (NowUTC and
GetTickCount64, the only 2 functions defined in that unit, don't seem to
have any relation with utf8).

The idea was that one day it would contain utf8 versions of sysutils
routines too + extra functions which are alternatives to rtl ones but
not related to text encoding like the 2 you mention.



IMHO, these functions would be better located in the FPC RTL, as they 
are more "general" than what the Lazarus library is about.


Same might be true for UTF8 helper functions.

-Michael

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


Re: [Lazarus] Now function - returning UTC?

2014-04-21 Thread Felipe Monteiro de Carvalho
On Sat, Apr 19, 2014 at 4:07 PM, Luca Olivetti  wrote:
> BTW, the name of the unit isn't really meaningful (NowUTC and
> GetTickCount64, the only 2 functions defined in that unit, don't seem to
> have any relation with utf8).

The idea was that one day it would contain utf8 versions of sysutils
routines too + extra functions which are alternatives to rtl ones but
not related to text encoding like the 2 you mention.

-- 
Felipe Monteiro de Carvalho

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


Re: [Lazarus] Now function - returning UTC?

2014-04-19 Thread David Taylor

On 19/04/2014 19:55, Luca Olivetti wrote:

El 19/04/14 17:37, David Taylor ha escrit:


Can anyone help with this apparently simple problem?


lazutf8sysutils has a NowUTC function already defined

Bye


Oh, that's /most/ helpful!  Many thanks

--
David
Web: http://www.satsignal.eu


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


Re: [Lazarus] Now function - returning UTC?

2014-04-19 Thread Luca Olivetti
El 19/04/14 20:55, Luca Olivetti ha escrit:
> El 19/04/14 17:37, David Taylor ha escrit:
> 
>> Can anyone help with this apparently simple problem?
> 
> lazutf8sysutils has a NowUTC function already defined

BTW, the name of the unit isn't really meaningful (NowUTC and
GetTickCount64, the only 2 functions defined in that unit, don't seem to
have any relation with utf8).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

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


Re: [Lazarus] Now function - returning UTC?

2014-04-19 Thread Luca Olivetti
El 19/04/14 17:37, David Taylor ha escrit:

> Can anyone help with this apparently simple problem?

lazutf8sysutils has a NowUTC function already defined

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

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


Re: [Lazarus] Now function - returning UTC?

2014-04-19 Thread silvioprog
2014-04-19 12:37 GMT-03:00 David Taylor :

> I have a version of the Now function which works in Windows and returns
> UTC.
>
> function NowUTC: TDateTime;
> var
>   system_datetime: TSystemTime;
> begin
>   GetSystemTime (system_datetime);
>   Result := SystemTimeToDateTime (system_datetime);
> end;


I'm used this:

class function TDropboxOAuthUtil.GenerateTimeStamp: string;
{$IFNDEF FPC}
var
  VCurTime: TSystemTime;
{$ENDIF}
begin
{$IFNDEF FPC}
  GetSystemTime(VCurTime);
{$ENDIF}
  Result := IntToStr(DateTimeToUnix({$IFDEF
FPC}LocalTimeToUniversal(Now){$ELSE}
SystemTimeToDateTime(VCurTime){$ENDIF}));
end;

-- 
Silvio Clécio
My public projects - github.com/silvioprog
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Now function - returning UTC?

2014-04-19 Thread David Taylor

I have a version of the Now function which works in Windows and returns UTC.

function NowUTC: TDateTime;
var
  system_datetime: TSystemTime;
begin
  GetSystemTime (system_datetime);
  Result := SystemTimeToDateTime (system_datetime);
end;

I've had an enquiry for a version of this for Lazarus, to run on the 
Raspberry Pi (Debian) but my Linux knowledge isn't up to writing an 
equivalent.  I've searched and don't see GetSystemTime in FreePascal.


Can anyone help with this apparently simple problem?

Thanks,
David
--
Web: http://www.satsignal.eu


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