summaryrefslogtreecommitdiff
path: root/libc/misc/time/asc_conv.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-10-09 20:06:30 +0000
committerEric Andersen <andersen@codepoet.org>2000-10-09 20:06:30 +0000
commitc1fe19d4c1db610692365472a90f4661e48449c1 (patch)
treed0b0219ffca3c4c4256f55c4aea4513e43d6aecd /libc/misc/time/asc_conv.c
parent9efafb8bbc7408b04643dcd53825d971577b4d9d (diff)
Bug ugly formatting update
Diffstat (limited to 'libc/misc/time/asc_conv.c')
-rw-r--r--libc/misc/time/asc_conv.c68
1 files changed, 33 insertions, 35 deletions
diff --git a/libc/misc/time/asc_conv.c b/libc/misc/time/asc_conv.c
index 78cbcdd8d..9f8c25844 100644
--- a/libc/misc/time/asc_conv.c
+++ b/libc/misc/time/asc_conv.c
@@ -6,44 +6,42 @@
*/
-static void
-hit(buf, val)
-char * buf;
+static void hit(buf, val)
+char *buf;
int val;
{
- *buf = '0' + val%10;
+ *buf = '0' + val % 10;
}
-void
-__asctime(buffer, ptm)
-register char * buffer;
-struct tm * ptm;
+void __asctime(buffer, ptm)
+register char *buffer;
+struct tm *ptm;
{
-static char days[] = "SunMonTueWedThuFriSat";
-static char mons[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
- int year;
-
- /* 012345678901234567890123456 */
- strcpy(buffer, "Err Err .. ..:..:.. ....\n");
- if( (ptm->tm_wday >= 0) && (ptm->tm_wday <= 6) )
- memcpy(buffer, days+3*(ptm->tm_wday), 3);
-
- if( (ptm->tm_mon >= 0) && (ptm->tm_mon <= 11) )
- memcpy(buffer+4, mons+3*(ptm->tm_mon), 3);
-
-
- hit(buffer+ 8, ptm->tm_mday/10);
- hit(buffer+ 9, ptm->tm_mday );
- hit(buffer+11, ptm->tm_hour/10);
- hit(buffer+12, ptm->tm_hour );
- hit(buffer+14, ptm->tm_min/10);
- hit(buffer+15, ptm->tm_min );
- hit(buffer+17, ptm->tm_sec/10);
- hit(buffer+18, ptm->tm_sec );
-
- year = ptm->tm_year + 1900;
- hit(buffer+20, year/1000);
- hit(buffer+21, year/100);
- hit(buffer+22, year/10);
- hit(buffer+23, year);
+ static char days[] = "SunMonTueWedThuFriSat";
+ static char mons[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
+ int year;
+
+ /* 012345678901234567890123456 */
+ strcpy(buffer, "Err Err .. ..:..:.. ....\n");
+ if ((ptm->tm_wday >= 0) && (ptm->tm_wday <= 6))
+ memcpy(buffer, days + 3 * (ptm->tm_wday), 3);
+
+ if ((ptm->tm_mon >= 0) && (ptm->tm_mon <= 11))
+ memcpy(buffer + 4, mons + 3 * (ptm->tm_mon), 3);
+
+
+ hit(buffer + 8, ptm->tm_mday / 10);
+ hit(buffer + 9, ptm->tm_mday);
+ hit(buffer + 11, ptm->tm_hour / 10);
+ hit(buffer + 12, ptm->tm_hour);
+ hit(buffer + 14, ptm->tm_min / 10);
+ hit(buffer + 15, ptm->tm_min);
+ hit(buffer + 17, ptm->tm_sec / 10);
+ hit(buffer + 18, ptm->tm_sec);
+
+ year = ptm->tm_year + 1900;
+ hit(buffer + 20, year / 1000);
+ hit(buffer + 21, year / 100);
+ hit(buffer + 22, year / 10);
+ hit(buffer + 23, year);
}