Bug 1017490 - rewrite clock build script in javascript