This is the goal: count from 0 all the way to the current epoch time while the epoch time is still advancing in the fastest time possible. An example of how you'd do it could be as what is shown here in Python 2.7:

from time import time
start, end, count = None, None, 0
while count <= time():
    if start == None: start = time()
    count += 1
    end = time()

The above code took 10 minutes and 8 seconds to run through on an 8-core AMD with 16 GB of RAM. You must do it faster than that without skipping numbers and starting from zero.


Achieving a lower time than what Python did is the goal in addition to using the least amount of code too, but special attention will be given to the following:

  • Code that takes the precise epoch time sourced from your counting to display something mentioning historical events or irrelevant ones that can be found on Wikipedia. (10 points)
  • Getting the current epoch time from a source other than your own. (5 points)
  • Your application continues to count alongside the epoch time after it catches up. (5 points)

50 points will be awarded to the person who achieves the lowest time and additional bonus points will be awarded from above if they're met.


The contest closes June 1st.


closed as unclear what you're asking by mniip, Martin Ender, TheDoctor, durron597, Level River St May 10 '14 at 22:22

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    \$\begingroup\$ How much are the bonuses worth? You define them, but don't give them a value. \$\endgroup\$ – undergroundmonorail May 10 '14 at 20:42
  • 3
    \$\begingroup\$ Your scoring is still completely arbitrary. How are time and code size factored into a single score, how much is a "point" worth? \$\endgroup\$ – Martin Ender May 10 '14 at 20:50
  • 1
    \$\begingroup\$ So I suppose now the base score is code size in bytes (= points), and then -50 for the fastest and -10/5/5 for the bonuses? How can you possibly display historical events with 10 bytes of code? Regardless, the combination of multiple scoring criteria makes this a "code-challenge" and not "code-golf". \$\endgroup\$ – Martin Ender May 10 '14 at 20:54
  • 1
    \$\begingroup\$ What is the purpose of start and end in your example? They don't do anything, and otherwise it's just a simple loop to a billion or so. Why does it take over 10 minutes to run? \$\endgroup\$ – Geobits May 10 '14 at 21:03
  • 1
    \$\begingroup\$ @Geobits I think the real "challenge" intended is to minimize the number of calls to time(), but personally I don't think it's gonna make much difference... \$\endgroup\$ – ace_HongKongIndependence May 10 '14 at 22:55

C, about 5 seconds

#include <stdio.h>
#include <time.h>

int main(){
  time_t t=0, margin=0x40000000;
  int i;
  while (margin) {
    for (i=0;i<margin;i++) t++;
    while (margin && time(NULL)-t < margin) margin /= 2;
  printf("t=%ld, time=%ld\n",t,time(NULL));
  return 0;

Java : 140

No bonuses, ~60ms runtime

Sets the start time in j and doesn't check time again until j is reached. Once it is, it keeps counting up to current time. Generally it only needs to check the time twice, since it runs in well under a second.

class N{public static void main(String[]a){for(int i=0,j=t();i++<j||i<t(););}static int t(){return (int)(System.currentTimeMillis()/1000);}}

Line breaks for clarity:

class N{
    public static void main(String[]a){
        for(int i=0,j=t();i++<j||i<t(););
    static int t(){return (int)(System.currentTimeMillis()/1000);}

Not the answer you're looking for? Browse other questions tagged or ask your own question.