Probably has to do with global scope. Try putting it in a function:

julia> function f()
       tic()
       start = time()
       sleep(1)
       done = time()
       toc()
       println(done - start)
       end
f (generic function with 1 method)

julia> f()
elapsed time: 1.003258943 seconds
1.0033071041107178



On Saturday, November 28, 2015 at 9:19:24 AM UTC-8, Thomas Hatch wrote:
>
> First off, Julia is fantastic! I am just trying to figure out out 
> something odd I am seeing with the time() function.
>
> if I write this code in julia:
>
> tic() 
> start = time() 
> sleep(1) 
> done = time() 
> toc() 
> println(done - start)
>
> I get this output
>
> elapsed time: 1.092225041 seconds 
> 1.0776820182800293
>
> That is more than 1 second, the same code in python (no tic and toc of 
> course) shows 0.01 over 1 second.
>
> So I am just curious, where do the extra 0.07 seconds come from?
>

Reply via email to