Actually I just realised this may be a timezone issue rather than a precision 
issue.

I’ve done it this way:

******* 1. Get UTC Time *******

$P_timeString:=String(Current date(*);ISO date GMT;Current time(*))

$P_timeString:=Replace string($P_timeString;"Z";””). <— Prevent it from 
reverting back to local time

$P_date:=Date($P_timeString)
$P_time:=time($P_timeString)


********2. convert to Posix *****

$P_baseDATE:=!01/01/1970! 

$P_countDAYS:=($P_date-$P_baseDATE)  //     Gets the whole number od days 
elapsed
$P_countSECONDS:=($P_time +0)

$P_posixTIME:=(($P_countDAYS*86400)+$P_countSECONDS)

$0:=Int($P_posixTIME)*1000



> On 19 Feb 2019, at 23:25, Peter Jakobsson via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> The problem is that if I convert Current Date and Current Time to 
> milliseconds there’s a precision error of up to a second and the API server’s 
> I’m using think I’m out of sync

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to