<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">Am 24.10.2017 13:41 schrieb "el es via Lazarus" <<a href="mailto:lazarus@lists.lazarus-ide.org">lazarus@lists.lazarus-ide.org</a>>:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On 24/10/17 10:04, Mattias Gaertner via Lazarus wrote:<br>
> On Tue, 24 Oct 2017 08:59:36 +0100<br>
> el es via Lazarus <<a href="mailto:lazarus@lists.lazarus-ide.org">lazarus@lists.lazarus-ide.org</a><wbr>> wrote:<br>
><br>
>> On 23/10/17 20:00, Giuliano Colla via Lazarus wrote:<br>
>> [snip]<br>
>><br>
>> I don't remember if I was hitting AV using Now(), likely I wasn't -<br>
>> but due to 'normal' Now() being not thread safe, I was getting inconsistent<br>
>> timing results, when I used Now() both in main thread and in the thread;<br>
><br>
> AFAIK Now is thread safe. On what platform and how did you test?<br>
><br>
> Mattias<br>
><br>
<br>
</div>Now() is literally<br>
<br>
function Now : TDateTime;<br>
var ASystemTime : TSYSTEMTIME;<br>
begin<br>
GetSystemTime(ASystemTime);<br>
Result := SystemTimeToDateTime(<wbr>ASystemTime);<br>
end;<br>
<br>
on my installation (lazarus 1.6.4 #54278, FPC 3.0.2)<br>
<br>
I'd say it's questionable to say it's thread-safe that way; It may be safe to use in<br>
main thread (where no 2 different contexts can mangle each others ASystemTime);<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">ASystemTime is a local variable, so two threads won't influence each other there thus at least on Windows Now() is threadsafe. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven</div></div>