Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save charlie-x/de1ecaf6c892dcb5a9f70ceacfccdb5a to your computer and use it in GitHub Desktop.
Save charlie-x/de1ecaf6c892dcb5a9f70ceacfccdb5a to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <sys/time.h>
int gcd(int a, int b);
void main()
{
struct timeval tvTime;
struct tm tmOutput;
gettimeofday(&tvTime, 0);
localtime_r(&(tvTime.tv_sec), &tmOutput);
tmOutput.tm_mon += 1;
printf("password for today is: %x%02d-%02x%02d\n\n",
tmOutput.tm_mon, tmOutput.tm_mon, tmOutput.tm_mday,
gcd(tmOutput.tm_mon, tmOutput.tm_mday));
}
int gcd(int a, int b)
{
return (b?gcd(b,a%b):a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment