A word-based approximate-time Internet Clock for your website
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


#JsWordyClock JsWordyClock is a JavaScript port of Ken Lim's pyWordyClock, with the appropriate modifications for use on the web as an Internet Clock. It's a word-based, approximate time clock, accurate to within about 3 minutes. It comes with its own JavaScript test suite.

##Usage: There is a single constructor function called JsWordyClock. It takes two arguments:

required: an HTML element, used as the container for the clock

optional: a font size, in string form, including the measurement unit. Defaults to '1em' if omitted. You may need to play around with the font size to get it to fit your container nicely. I use a monospace font so the text will be justified on both sides, but there's no auto-scaling yet, hence the need to set the size manually.

Include either src/jsWordyClock or dist/jsWordyClock-min.js on your web page:

<script src="jsWordyClock-min.js"></script>

then create an instance of the clock like this:

var div = document.getElementById('myClock');
var clock = new JsWordyClock(div, '38px');

##Build/Minification: Tools are included to create the minified version of the script. On *nix run the build.sh bash script in the root directory, which invokes the supplied YUI-Compressor and puts a copy of the minified script in both the dist and web directories. to run it use:


If you have any problems you may need to use:

sudo ./build.sh

##Demo: There is a complete working demo in the web directory. Just open the index.html file in a web browser.

##Tests There is a test suite in the test directory. The lib directory contains the JsTestDriver test runner you will need to run the tests. To run the tests:

  1. open a terminal window
  2. cd into the root directory of the JsWordyClock repo
  3. java -jar lib/JsTestDriver-1.2.2.jar --port 9876
  4. open a browser at
  5. click the 'capture this browser' link
  6. open a new terminal window
  7. java -jar lib/JsTestDriver-1.2.2.jar --reset --config conf/jsTestDriver.conf --tests all
  8. tests will be run in the captured browser (you may capture more than one at a time if you want) and the results reported in the terminal window you ran them from