develooper Front page | perl.perl5.porters | Postings from August 2001

[PATCH] *time_r again

From:
Arthur Bergman
Date:
August 16, 2001 06:56
Subject:
[PATCH] *time_r again
Message ID:
00ca01c1265c$0175f940$21000a0a@vogw2kdev
Mumble mumble mumble incomplete HP-UX manpages.

I had hoped to avoid ifdefing here, but return value of 0 on sucess makes it impossible.

Arthur

--- perl-current-clone/op.h Thu Aug 16 14:33:33 2001
+++ perl-current/op.h Thu Aug 16 15:44:29 2001
@@ -464,7 +464,21 @@
 typedef struct {
   struct tm* tmbuff;
 } REBUF;
-#define localtime(a)       (localtime_r(a,PL_reentrant_buffer->tmbuff) && PL_reentrant_buffer->tmbuff)
-#define gmtime(a)          (gmtime_r(a,PL_reentrant_buffer->tmbuff) && PL_reentrant_buffer->tmbuff)
+
+#define localtime(a)       (localtime_r(a,PL_reentrant_buffer->tmbuff && PL_reentrant_buffer->tmbuff)
+#define gmtime(a)          (gmtime_r(a,PL_reentrant_buffer->tmbuff && PL_reentrant_buffer->tmbuff)
+
+#if defined(__hpux) && defined(__ux_version) && __ux_version <= 1020
+
+/* HP-UX 10.20 returns 0 on success, what it returns on failure is hidden
+   in the fog somewhere, possibly -1 which means the following should do 
+   the right thing - 20010816 sky */
+
+#undef localtime
+#undef gmtime
+#define localtime(a)       ((localtime_r(a,PL_reentrant_buffer->tmbuff)+1) && PL_reentrant_buffer->tmbuff)
+#define gmtime(a)          ((gmtime_r(a,PL_reentrant_buffer->tmbuff)+1) && PL_reentrant_buffer->tmbuff)
+#endif /* HP-UX 10.20 */
+
 #endif
 





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About