freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master f7bb872: * src/ftdump.c (Print_Name): Ignore ne


From: Werner Lemberg
Subject: [freetype2-demos] master f7bb872: * src/ftdump.c (Print_Name): Ignore negative pre-epoch time.
Date: Thu, 9 Sep 2021 22:39:22 -0400 (EDT)

branch: master
commit f7bb872e9ef8358b2a5f935738380a1a8847be22
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/ftdump.c (Print_Name): Ignore negative pre-epoch time.
---
 src/ftdump.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/ftdump.c b/src/ftdump.c
index 4bcada8..fddddd7 100644
--- a/src/ftdump.c
+++ b/src/ftdump.c
@@ -160,16 +160,17 @@
       modified = head->Modified[0] == 1 ? modified + 2212122496U
                                         : modified - 2082844800U;
 
-      /* gmtime cannot deal with negative times on some systems */
-      if ( created  < 0 )
-        created  = 0;
-      if ( modified < 0 )
-        modified = 0;
-
-      strftime( buf, sizeof ( buf ), "%Y-%m-%d", gmtime( &created  ) );
-      printf( "%s%s\n", Name_Field( "created" ), buf );
-      strftime( buf, sizeof ( buf ), "%Y-%m-%d", gmtime( &modified ) );
-      printf( "%s%s\n", Name_Field( "modified" ), buf );
+      /* ignore pre-epoch time that gmtime cannot handle on some systems */
+      if ( created  >= 0 )
+      {
+        strftime( buf, sizeof ( buf ), "%Y-%m-%d", gmtime( &created  ) );
+        printf( "%s%s\n", Name_Field( "created" ), buf );
+      }
+      if ( modified >= 0 )
+      {
+        strftime( buf, sizeof ( buf ), "%Y-%m-%d", gmtime( &modified ) );
+        printf( "%s%s\n", Name_Field( "modified" ), buf );
+      }
 
       printf( "%s%.2f\n", Name_Field( "revision" ),
               head->Font_Revision / 65536.0 );



reply via email to

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