plugins.xkcd: Microsoft apparently hates %T (crashes on Windows)

Sun, 17 Jul 2011 02:03:21 +0200

author
God of Dice@mf-nb
date
Sun, 17 Jul 2011 02:03:21 +0200
changeset 77
7e50244d8e42
parent 76
cecdfba8e625
child 78
00ad6fe8975e

plugins.xkcd: Microsoft apparently hates %T (crashes on Windows)

reformat Code

plugins/xkcd.lua file | annotate | diff | comparison | revisions
--- a/plugins/xkcd.lua	Sun Jul 24 19:16:40 2011 +0700
+++ b/plugins/xkcd.lua	Sun Jul 17 02:03:21 2011 +0200
@@ -7,9 +7,9 @@
 	local http = require("net.http");
 	bot:hook("commands/xkcd", function(command)
 		if os.difftime(os.time(), xkcd_list_updated_at) > (3 * 60 * 60) then -- Not refreshed within 3 hours
-			http.request('http://xkcd.com/archive/', {
-					headers = { ["If-Modified-Since"] = os.date("!%a, %d %b %Y %T %Z", xkcd_list_updated_at or 0) }
-				}, function (data, code)
+            --COMPAT We could have saved 6 bytes here, but Microsoft apparently hates %T, so you got this gigantic comment instead.
+			-- http.request('http://xkcd.com/archive/', { headers = { ["If-Modified-Since"] = os.date("!%a, %d %b %Y %T %Z", xkcd_list_updated_at or 0) } }, function (data, code)
+            http.request('http://xkcd.com/archive/', { headers = { ["If-Modified-Since"] = os.date("!%a, %d %b %Y %H:%M:%S %Z", xkcd_list_updated_at or 0) } }, function (data, code)
 				if code == 200 then
 					xkcd_list_updated_at = os.time();
 					print("debug", "got "..(#data or 0).." bytes of data");

mercurial