diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-20 22:19:54 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-20 22:19:54 +0000 |
commit | f7579db9e830ef41f422a280d26c9077f48728e5 (patch) | |
tree | d96affac7f5e8203d2e9c4a053213a992cd76650 /etc | |
parent | 5dc5c3ebe8f111bba01762ca0f5edba912c4f0b9 (diff) | |
download | luasocket-f7579db9e830ef41f422a280d26c9077f48728e5.tar.gz luasocket-f7579db9e830ef41f422a280d26c9077f48728e5.tar.bz2 luasocket-f7579db9e830ef41f422a280d26c9077f48728e5.zip |
Fixing bugs...
Diffstat (limited to 'etc')
-rw-r--r-- | etc/get.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/etc/get.lua b/etc/get.lua index c7e2a43..712d807 100644 --- a/etc/get.lua +++ b/etc/get.lua | |||
@@ -4,11 +4,11 @@ | |||
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id$ | 5 | -- RCS ID: $Id$ |
6 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
7 | socket = require("socket") | 7 | local socket = require("socket") |
8 | http = require("http") | 8 | local http = require("http") |
9 | ftp = require("ftp") | 9 | local ftp = require("ftp") |
10 | url = require("url") | 10 | local url = require("url") |
11 | ltn12 = require("ltn12") | 11 | local ltn12 = require("ltn12") |
12 | 12 | ||
13 | -- formats a number of seconds into human readable form | 13 | -- formats a number of seconds into human readable form |
14 | function nicetime(s) | 14 | function nicetime(s) |
@@ -64,11 +64,11 @@ end | |||
64 | -- creates a new instance of a receive_cb that saves to disk | 64 | -- creates a new instance of a receive_cb that saves to disk |
65 | -- kind of copied from luasocket's manual callback examples | 65 | -- kind of copied from luasocket's manual callback examples |
66 | function stats(size) | 66 | function stats(size) |
67 | local start = socket.time() | 67 | local start = socket.gettime() |
68 | local got = 0 | 68 | local got = 0 |
69 | return function(chunk) | 69 | return function(chunk) |
70 | -- elapsed time since start | 70 | -- elapsed time since start |
71 | local delta = socket.time() - start | 71 | local delta = socket.gettime() - start |
72 | if chunk then | 72 | if chunk then |
73 | -- total bytes received | 73 | -- total bytes received |
74 | got = got + string.len(chunk) | 74 | got = got + string.len(chunk) |