www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 9425a991b12a9f1341178c2b8c6d684f4bc9239a
parent 7efd8c4fb0e553aa9f9d9509be55ff180af0ec4e
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon,  3 Aug 2009 02:02:17 +0000

File mod time test


Diffstat:
Achrome/content/zotero/test/modtime.js | 26++++++++++++++++++++++++++
Achrome/content/zotero/test/modtime.xul | 15+++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/test/modtime.js b/chrome/content/zotero/test/modtime.js @@ -0,0 +1,26 @@ +var tmp = Zotero.getTempDirectory(); +tmp.append(Zotero.randomString()); +tmp.create(Components.interfaces.nsIFile.FILE_TYPE, 0644); + +var date = new Date(); +var nowTS = Zotero.Date.toUnixTimestamp(date) * 1000; + +var fileOriginalTS = tmp.lastModifiedTime; + +var date = new Date("June 1, 2009 12:34:56"); +var fileSetTS = Zotero.Date.toUnixTimestamp(date) * 1000; +tmp.lastModifiedTime = fileSetTS; + +var fileGetTS = tmp.lastModifiedTime; + +tmp.remove(false); + +var str = "Current time: " + Date(nowTS) + "\n" + + "File original time: " + Date(fileOriginalTS) + "\n" + + "File set time: " + Date(fileSetTS) + "\n" + + "File get time: " + Date(fileGetTS) + "\n\n" + + (fileSetTS == fileGetTS ? "PASS" : "FAIL (" + fileSetTS + " != " + fileGetTS + ")"); + +var prompt = Components.classes["@mozilla.org/network/default-prompt;1"] + .getService(Components.interfaces.nsIPrompt); +prompt.alert('', str); diff --git a/chrome/content/zotero/test/modtime.xul b/chrome/content/zotero/test/modtime.xul @@ -0,0 +1,15 @@ +<?xml version="1.0"?> + + +<window + id="test-window" + title="Last Modified Time Test" + orient="horizontal" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + style="padding:2em"> + + <script src="../include.js"/> + <script src="modtime.js"/> + + <box/> +</window>