[project @ 1999-10-29 13:52:30 by sof]
[ghc-hetmet.git] / ghc / lib / std / cbits / showTime.c
index 4efab2c..8026a03 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: showTime.c,v 1.4 1999/09/30 12:42:26 sof Exp $
+ * $Id: showTime.c,v 1.6 1999/09/30 16:20:14 sof Exp $
  *
  * ClockTime.showsPrec Runtime Support
  */
 # endif
 #endif
 
-StgAddr
+StgInt
 showTime(I_ size, StgByteArray d, I_ maxsize, StgByteArray buf)
 {
     time_t t;
     struct tm *tm;
 
+    /*
+     * I allege that with the current (9/99) contents of Time.lhs,
+     * size will always be >= 0.   -- sof
+     */
     switch(size) {
        case 0:
            t = 0;
            break;
-       case -1:
-           t = - (time_t) ((StgInt *)d)[0];
-           break;
        case 1:
            t = (time_t) ((StgInt *)d)[0];
            break;
@@ -40,7 +41,7 @@ showTime(I_ size, StgByteArray d, I_ maxsize, StgByteArray buf)
            return (-1);
        }
     tm = localtime(&t);
-    if (tm != NULL && strftime(buf, maxsize, "%a %b %d %T %Z %Y", tm) > 0) {
+    if (tm != NULL && strftime(buf, maxsize, "%a %b %d %H:%M:%S %z %Y", tm) > 0) {
        return 1;
     } else {
        return (-1);