1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- The general test program now also exercises the time conversion functions.

git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14811 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-01-25 11:21:58 +00:00
parent 003faf7a24
commit e8d4187ea5

View File

@ -1,5 +1,5 @@
/*
* $Id: test.c,v 1.1.1.1 2004-07-26 16:36:08 obarthel Exp $
* $Id: test.c,v 1.2 2005-01-25 11:21:58 obarthel Exp $
*
* :ts=4
*/
@ -65,9 +65,12 @@ int bar = 9;
int
main(int argc,char ** argv)
{
struct timeval tv;
time_t now;
struct tm tm;
int i,j,k;
long n,r;
char time_buffer[100];
for(i = 0 ; i < argc ; i++)
printf("%2d) \"%s\"\n",i,argv[i]);
@ -77,6 +80,32 @@ main(int argc,char ** argv)
time(&now);
printf("%s",ctime(&now));
tm = (*localtime(&now));
strftime(time_buffer,sizeof(time_buffer),"%c",&tm);
printf("local time = %s\n",time_buffer);
tm = (*gmtime(&now));
strftime(time_buffer,sizeof(time_buffer),"%c",&tm);
printf("gmt = %s\n",time_buffer);
tm.tm_year = 105;
tm.tm_mon = 0;
tm.tm_mday = 25;
tm.tm_hour = 12;
tm.tm_min = 3;
tm.tm_sec = 53;
tm.tm_isdst = -1;
now = mktime(&tm);
tm = (*localtime(&now));
strftime(time_buffer,sizeof(time_buffer),"%c",&tm);
printf("2005-01-25 12:03:53 -> local time = %s\n",time_buffer);
tm = (*gmtime(&now));
strftime(time_buffer,sizeof(time_buffer),"%c",&tm);
printf("2005-01-25 12:03:53 -> gmt = %s\n",time_buffer);
#if defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT)
{
const double pi = 3.14159265358979323846;
@ -155,6 +184,9 @@ main(int argc,char ** argv)
}
#endif*/
gettimeofday(&tv,0);
printf("time = %d.%06d\n",tv.tv_sec,tv.tv_usec);
if(argc > 1)
{
DIR * dir;