Bug 1017490 part 1 - rewrite clock build script in javascript