Home > i.t. > Godaddy cron job 的执行时间最大是36秒

Godaddy cron job 的执行时间最大是36秒

January 12th, 2008

想想也是,这种相对来说比较便宜的共享空间,也不会让你占用太多的系统资源。
刚写了一个死循环的脚本,跑了一下,得出的时间是36妙。

#!/usr/local/bin/ruby
# index.cgi
require "time"

i=0
tm = Time.now
newfile = File.open( "time1.html", "w+",0644)
newfile << tm.min().to_s + ":" + tm.sec().to_s + "\n"
newfile.close

while true
  i=i+1
  if i % 1000000 == 0 then
    tm = Time.now
    newfile = File.open("time2.html", "w+",0644)
    newfile << tm.min().to_s + ":" + tm.sec().to_s + "\n"
    newfile.close
  end

end

time1.html和time2.html的时间相差了36妙。
有个老外也碰到了这个问题。
http://bogdan.org.u......html
不光跑ruby有这个问题,跑python,ELF等也有这个问题。

webflier i.t.

  1. No comments yet.
  1. No trackbacks yet.