<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>Hi,</div><div><br></div>I am getting this error:<div><br></div><div><div><font face="Andale Mono"><span style="font-style: normal;">agame.m:158: In clause for predicate `game_loop'/8:</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">agame.m:158: in unification of variable `Diff'</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">agame.m:158: and term `(Now - Then)':</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">agame.m:158: type error in arguments of functor `-'/2.</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">agame.m:158: Argument 1 (Now) has type `int64',</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">agame.m:158: expected type was `int'.</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">agame.m:158: Argument 2 (Then) has type `int64',</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">agame.m:158: expected type was `int'.</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">** Error making `Mercury/cs/agame.c'.</span></font></div></div><div><br></div><div>I have this predicate, an FFI, to get the current 64 bit tick counter:</div><div><br></div><div><div><font face="Andale Mono"><span style="font-style: normal;">:- pred sdl_getticks64(int64::out, io::di, io::uo) is det.</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"><br></span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">:- pragma foreign_proc("C", sdl_getticks64(Ticks::out, _IO0::di, _IO::uo),</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"> [promise_pure,will_not_call_mercury,does_not_affect_liveness],</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">"</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"> Ticks = SDL_GetTicks64();</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">").</span></font></div></div><div><br></div><div>I assign it like this in the setup code</div><div><br></div><div><div><font face="Andale Mono"><span style="font-style: normal;"> sdl_getticks64(Now, !IO),</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"> game_loop(Window, Renderer, Now, Now, !GameState, !IO),</span></font></div></div><div><br></div><div><br></div><div>ad then in the game loop I calculate the difference but I don't see how I've failed to convey to the compiler the use of 64 bits!</div><div><br></div><div><div><font face="Andale Mono"><span style="font-style: normal;"> :- pred game_loop(sdl_window::in, sdl_renderer::in, int64::in, int64::in,</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"> game_state::in, game_state::out, io::di, io::uo) is det.</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"><br></span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"> 157: game_loop(W, R, Now, Then, !State, !IO) :-</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;">==> 158: Diff = (Now-Then),</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"> io.format("Now: %li, Then: %li, Diff: %li\n",</span></font></div><div><font face="Andale Mono"><span style="font-style: normal;"> [ i64(Now), i64(Then), i64(Diff) ], !IO),</span></font></div></div><div><br></div><div><br></div><div>I can't see where it thinks the expected type was 'int'. Is there a different library I should use, I looked but couldn't really find anything in 'int' or 'math'.</div><div><br></div><div>Thanks,</div><div>Sean.</div><div><br></div><div><br></div></body></html>