Skip to content

Instantly share code, notes, and snippets.

@iczelia
Created January 30, 2025 01:30
Show Gist options
  • Select an option

  • Save iczelia/e80a53305dba6d31aa9b4502ba02d5af to your computer and use it in GitHub Desktop.

Select an option

Save iczelia/e80a53305dba6d31aa9b4502ba02d5af to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <time.h>
void f(long u) {
char*ms="SunMonTueWedThuFriSatJanFebMarAprMayJunJulAugSepOctNovDec";
int t=u%86400,od=u/86400,y,d=od,m,a,mp;if(d>11016)y=100,d++;y+=(d=(4
*d+2877875)%146097|3)/1461;a=(d=d%1461/4+1)-307;m=((d*=5)-3)/153;if(
(mp=m+2)>11)mp-=12,y++;printf("%02d:%02d:%02d (UTC), %.3s %02d %.3s"
" %d (day %d)",t/3600,(t/60)%60,t%60,ms+3*((od+4)%7),(d+2-153*m)/5-1
,ms+21+3*m,y+1900,(a>=0?a:a+365)+(!(y&3)&&a<0)); }
int main(void) { f(time(NULL)); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment