[Go Back] Q: How does your web browser know how much time is left in an auction at ArrowOutlet.com?

A: ArrowOutlet's server does not tell your web browser how many seconds are left in an auction. Instead, it tells your web browser the time (for example, 2:31:05 PM) when an auction is planning to end. Your browser must subtract this ending time from the current time in order to display how many seconds are left. This poses a problem. The ending time refers to ArrowOutlet's clock while the only current time you have is your clock. You cannot subtract these two times. Your clock may differ by seconds, minutes, or even hours (different time zone) from ArrowOutlet's clock.

Your web browser must synchronize its internal clock to ArrowOutlet's clock first. Your web browser sends an HTTP POST request to ArrowOutlet.com with the variable 'action' = 'synchronizewatches!'. ArrowOutlet returns a JSON data type containing their clock's current time truncated to the nearest second. Your web browser sets its internal clock to this time.

Ignoring internet lag, your web browser's clock is now the same as ArrowOutlet's clock to within 1 second accuracy (plus or minus half a second). The reason it is not more accurate is because ArrowOutlet rounds their clock time down before they send it to you. For example, if their clock time is 2:45:20.75 PM (0.75 are fractions of a second), they only send you 2:45:20 PM. Therefore you set your clock to 2:45:20.00 PM when their clock says 2:45:20.75 PM. In this case, your clock would differ from theirs by 0.75 seconds.

Q: How did we obtain auction information to within plus or minus one thousandth of a second?

A: As explained above, a typical web browser can only obtain auction information to within plus or minus half a second. This was unsatisfactory for our project.

To overcome this, we rented a server in the same building as ArrowOutlet's server and we made a new web browser. This allowed us to sequentially send and receive up to 1000 HTTP requests to ArrowOutlet.com within one second and be immune to internet lag. To synchronize our web browser's clock to within plus or minus half a thousandth of a second, our web browser would ask ArrowOutlet, "What time does your clock say now?" each millisecond until their clock changed. For example,

At 1:12:30.001, we ask "What time?" and they respond, "1:12:30"
At 1:12:30.002, we ask "What time?" and they respond, "1:12:30"
At 1:12:30.003, we ask "What time?" and they respond, "1:12:30"
At 1:12:30.999, we ask "What time?" and they respond, "1:12:30"
At 1:12:31.000, we ask "What time?" and they respond, "1:12:31"

Since their clock just changed from 1:12:30 to 1:12:31, we know that their clock's time is precisely 1:12:31.000. We then set our clock to 1:12:31.000 and our clock is accurate to theirs within a thousandth of a second.