diff options
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) |