Advertisement
6_2008-2009 Internet/ HTML #199679

A better Atomic Time Synch

A sort of update to my last time sync entry. It's been totally rewritten so it now uses an NTP server (Network Time Protocol) to adjust your system time. Make sure you read the README.txt. If you like this code check out my site, http://www.em.f2s.com, I've got a program that will let you search planetsourcecode without even opening your browser! (it's akin to webferret)

AI

Resumen de IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Código fuente
original-source
Upload
#include<stdio.h>
#include<conio.h>
void main()
{
	int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int m,d,y,fh,h,f,i,jd=0,dow,j;
	clrscr();
	printf("Enter Month : ");
	scanf("%d",&m);
	printf("Enter the Year : ");
	scanf("%d",&y);
	/* To adjust 29 days for the Leap Year */
	if (y%4==0) month[2]=29;
	for(i=1;i< m; i++)
		jd=jd+month[i];
	jd=jd+1;
	dow=(jd+y+((y-1)/400)+((y-1)/4)-((y-1)/100))%7;
	printf(" Sat Sun Mon Tue Wed Thu Fri\n");
	for(j=0;j< dow;j++) printf("%4s");
	for(i=1;i< month[m]; i++)
	{
		printf("%4d",i);
		j=(j+1)%7;
		if(j==0) printf("\n");
	}
	getch();
}
Comentarios originales (3)
Recuperado de Wayback Machine