tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] patch for __DATE__ & __TIME__ support to tcc.0.9.16


From: Basile STARYNKEVITCH
Subject: [Tinycc-devel] patch for __DATE__ & __TIME__ support to tcc.0.9.16
Date: Tue, 31 Dec 2002 14:09:24 +0100

Dear All,

Here is a patch for support of __DATE__ & __TIME__. It works on my
Linux Debian (Sid, x86 Athlon) box.

Happy new Year 2003 to everyone.

--- tcc.c       2002-12-31 14:07:14.000000000 +0100
+++ tcc.c.orig  2002-12-31 13:34:46.000000000 +0100
@@ -29,10 +29,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <setjmp.h>
-
-#include <locale.h>
-#include <time.h>
-
 #ifdef WIN32
 #include <sys/timeb.h>
 #endif
@@ -3664,8 +3660,6 @@
     int mstr_allocated, parlevel, *mstr, t;
     TokenString str;
     char *cstrval;
-    static char datbuf[20];
-    static char timbuf[12];
     CValue cval;
     CString cstr;
             
@@ -3680,18 +3674,10 @@
         goto add_cstr;
         tok_str_add2(tok_str, TOK_STR, &cval);
     } else if (tok == TOK___DATE__) {
-      time_t nowtim = (time_t)0;
-      time(&nowtim);
-      memset(datbuf, 0, sizeof(datbuf));
-      strftime(datbuf, 12, "%b %e %Y", localtime(&nowtim));
-      cstrval = datbuf;
-      goto add_cstr;
+        cstrval = "Jan  1 2002";
+        goto add_cstr;
     } else if (tok == TOK___TIME__) {
-      time_t nowtim = (time_t)0;
-      time(&nowtim);
-      memset(timbuf, 0, sizeof(timbuf));
-      strftime(timbuf, 9, "%H:%M:%S", localtime(&nowtim));
-      cstrval = timbuf;
+        cstrval = "00:00:00";
     add_cstr:
         cstr_new(&cstr);
         cstr_cat(&cstr, cstrval);
@@ -9427,8 +9413,6 @@
     const char *optarg, *p1, *r1, *outfile;
     int print_search_dirs;
 
-    /* to avoid surprises, and for __DATE__ & __TIME__ support */
-    setlocale(LC_ALL, "C");
     s = tcc_new();
     output_type = TCC_OUTPUT_MEMORY;
 

-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
alias: basile<at>tunes<dot>org 
8, rue de la Faïencerie, 92340 Bourg La Reine, France



reply via email to

[Prev in Thread] Current Thread [Next in Thread]