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

int main(int argc, char **argv)
{
	struct tm *t;
	time_t now = time(NULL);
	int i = 0;
	long ts;
	long tgt = (13 * 60 + 37) * 60;
	t = localtime(&now);
	ts = (t->tm_hour * 60 + t->tm_min) * 60 + t->tm_sec;

	if(argc > 1)
	{
		if(!strcmp(argv[1], "-1337"))
		{
			tgt = (13 * 60 + 37) * 60;
		}
		else if(!strcmp(argv[1], "-31337"))
		{
			tgt = (3 * 60 + 13) * 60 + 37;
		}
		else
		{
			printf("Epic fail\n\n");
			printf("Options (choose one):\n");
			printf(" -1337   Print number of seconds until 13:37:00\n");
			printf(" -31337  Print number of seconds until  3:13:37\n");
			return 1;
		}
	}
	if(ts > tgt)
		ts -= 86400;

	if(argc > 1)
		printf("%d\n", tgt - ts);
	else
		printf("0x%x seconds until 13:37\n", tgt - ts);

	return 0;
}
