Hi,
On my mac
var span := RemObjects.Elements.Rtl.DateTime.TimeSince(new RemObjects.Elements.RTL.DateTime(1970,1,1));
writeLn(span.TotalSeconds);
That returns 1593726898.477118
On my raspberry pi I get 36357330542.7961
Cheers,
John
Hi,
On my mac
var span := RemObjects.Elements.Rtl.DateTime.TimeSince(new RemObjects.Elements.RTL.DateTime(1970,1,1));
writeLn(span.TotalSeconds);
That returns 1593726898.477118
On my raspberry pi I get 36357330542.7961
Cheers,
John
It sort of looks like utcnow is off
With this
var ts: rtl.__struct_timespec;
rtl.timespec_get(@ts, rtl.TIME_UTC);
is
ts.tv_sec
is that the number of seconds since 1,1,1970 ?
Thanks, logged as bugs://84595
Which one is “correct”? also is this Toffee/Mac vs Island/Linux or Island/Darwin/Mac vs Island/Linux?
Sorry its the Toffee one thats correct. Its Toffee/Mac vs Island/Linux
“good”
Island Darwin Mac gives me
!> Fatal exception of type RemObjects.Elements.System.Exception on thread 914F
!> Message: Null Reference Exception for expression: RemObjects.Elements.RTL.DateTimeHelpers.@_LocalTimezone
Thanks, logged as bugs://84598
bugs://84598 got closed with status cannotrepro.
Hi John,
please, could you post which code is getting the Null Reference Exception for Island Darwin platform?
I checked:
var span := RemObjects.Elements.Rtl.DateTime.TimeSince(new RemObjects.Elements.RTL.DateTime(1970,1,1));
writeLn(span.TotalSeconds);
but can not reproduce the NRE.
Thanks!
bugs://84598 got reopened.
fwiw, I cant repro the NRE on Island/Darwin either, I get
~> Process ConsoleApplication55 started
The magic happens here.
1594036.3632
~> Process ConsoleApplication55 terminated with exit code 0. Ran for 1.280
which looks correct?, for
namespace ConsoleApplication55;
type
Program = class
public
class method Main(args: array of String): Int32;
begin
// add your own code here
writeLn('The magic happens here.');
var span := RemObjects.Elements.Rtl.DateTime.TimeSince(new RemObjects.Elements.RTL.DateTime(1970,1,1));
writeLn(span.TotalSeconds);
end;
end;
end.
bugs://84595 got closed with status fixed.
property Ticks: Int64 read
{$IF COOPER}(mapped.TimeInMillis +mapped.TimeZone.getOffset(mapped.TimeInMillis)) * TimeSpan.TicksPerMillisecond + TicksTill1970
{$ELSEIF TOFFEE}Int64((mapped.timeIntervalSince1970 + DateTimeHelpers.LocalTimezone.secondsFromGMTForDate(mapped)) * TimeSpan.TicksPerSecond) + TicksTill1970
{$ELSEIF ECHOES OR ISLAND}fDateTime.Ticks
{$ENDIF};
It looks like its fDateTime.Ticks.
Im in Toronto so its EDT which is -4
Curious, I don’t see how this could NRE:
property Ticks: Int64 read
{$IF COOPER}(mapped.TimeInMillis +mapped.TimeZone.getOffset(mapped.TimeInMillis)) * TimeSpan.TicksPerMillisecond + TicksTill1970
{$ELSEIF TOFFEE}Int64((mapped.timeIntervalSince1970 + DateTimeHelpers.LocalTimezone.secondsFromGMTForDate(mapped)) * TimeSpan.TicksPerSecond) + TicksTill1970
{$ELSEIF ECHOES OR ISLAND}fDateTime.Ticks
{$ENDIF};
fDateTime is a value type, and it’s Ticks is a simple field-stored property:
property Ticks: Int64 read fTicks;
Sure you’re testing Island?
This is my project
DarwinTimeSinceConsoleApplication.zip (1.3 MB)
On toffee I get
~> Process ConsoleApplication64 started
The magic happens here.
1594035019.689765
~> Process ConsoleApplication64 terminated with exit code 0. Ran for 8.932
but I see how DateTimeHelpers.LocalTimezone being n il could cause a locale-specific issue there…
Now see, thats a ToffeeV2 project, which makes a difference for Elements RTL
Reproduced,
!> Message: Null Reference Exception for expression: RemObjects.Elements.RTL.DateTimeHelpers.@_LocalTimezone
Thats not island ?