Mail Archives: djgpp-workers/2005/01/07/16:16:33
On Fri, 07 Jan 2005 20:37:36 +0100 (CET), ams AT ludd DOT ltu DOT se wrote:
>According to Brian Inglis:
>1. > Index: tests/libc/ansi/time/ctime.c
>2. > ===================================================================
>3. > RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/time/ctime.c,v
>4. > diff -u -p ctime.c
>5. > --- /dev/null 2005-01-05 23:24:37.000000000 -0700
>6. > +++ time.c 2005-01-05 23:24:16.000000000 -0700
>7. > @@ -0,0 +1,49 @@
>8. > +/* ctime.c - basic ISO and POSIX time function calls */
>
>Ohoy there! tests/libc/ansi/time/ctime.c (line 1), ctime.c (line 4 and
>8) but time.c (line 6)! Note the missing "c".
>
>Line 4 hasn't the full name either, which mean (c)time.c won't be
>created in the proper place. At least it wasn't with my version of
>patch. (That could be my old patch or bad parameter from me.)
>
>Please make a little better patches.
>
>While I certainly do appreciate the work you do, you should try to
>make it easy for those who are trying to apply the patches.
Unfortunately, cvs diff does not seem to work with the -N option
when it is a new file with nothing to compare against,
so I tried to fake the cvs/rcs header based on a manual diff
generated before I renamed the file.
Please let me know if the following bare diff works
with your patch on your system,
then I know I can just omit the extra cvs/rcs junk.
Thanks. Take care, Brian Inglis
--- /dev/null 2005-01-07 13:58:01.000000000 -0700
+++ tests/libc/ansi/time/ctime.c 2005-01-05 23:57:42.000000000 -0700
@@ -0,0 +1,50 @@
+/* ctime.c - basic ISO and POSIX time function calls */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+int
+main( void )
+{
+ const char *tz[] = { "AZOT-1AZOST", "WET0WEST", "CET1CEST" };
+ unsigned z;
+ int o;
+
+
+ for (z = 0; z < sizeof tz / sizeof *tz; ++z)
+ {
+ setenv( "TZ", tz[z], 1);
+
+ for (o = 0; o <= 4; ++o)
+ {
+ time_t t;
+ struct tm * tmp;
+ struct tm tm;
+ char buf[BUFSIZ];
+
+ t = time( &t );
+ t = 1024*1024*1024/4*3*o;
+ printf( "time( %10u ) = %s\n", t, getenv( "TZ" ));
+ tmp = gmtime( &t );
+ printf( "gmtime( %10u ) = %s", t, asctime( tmp ));
+ tmp = localtime( &t );
+ printf( "localtime( %10u ) = %s", t, asctime( tmp ));
+ printf( "ctime( %10u ) = %s", t, ctime( &t ));
+ t = mktime( tmp );
+ strftime( buf, sizeof buf, "%c%n", tmp);
+ printf( "strftime( %10u ) = %s", t, buf);
+ printf( "difftime( %10u, 0) = %.0fs\n", t, difftime( t, 0));
+
+ t = 1024*1024*1024/4*3*o;
+ tmp = gmtime_r( &t, &tm);
+ printf( "gmtime_r( %10u, t) = %s", t, asctime_r( tmp, buf));
+ tmp = localtime_r( &t, &tm);
+ printf( "localtime_r( %10u, t) = %s", t, asctime_r( tmp, buf));
+ printf( "ctime_r( %10u, s) = %s\n", t, ctime_r( &t, buf));
+ }
+ }
+
+ return 0;
+
+} /* main() */
- Raw text -