extern int postnote(int, int, char *);
extern double p9pow10(int);
extern char* searchpath(char*);
+extern char* p9ctime(long);
#define p9setjmp(b) sigsetjmp((void*)(b), 1)
extern void sysfatal(char*, ...);
#undef strtod
#define strtod fmtstrtod
#define charstod fmtcharstod
+#define ctime p9ctime
#endif
/*
longt(Armember *bp)
{
char *cp;
- time_t date;
pmode(strtoul(bp->hdr.mode, 0, 8));
Bprint(&bout, "%3ld/%1ld", strtol(bp->hdr.uid, 0, 0), strtol(bp->hdr.gid, 0, 0));
Bprint(&bout, "%7ld", bp->size);
- date = bp->date;
- cp = ctime(&date);
- /* using unix ctime, not plan 9 time, so cp+20 for year, not cp+24 */
- Bprint(&bout, " %-12.12s %-4.4s ", cp+4, cp+20);
+ cp = ctime(bp->date);
+ Bprint(&bout, " %-12.12s %-4.4s ", cp+4, cp+24);
}
int m1[] = { 1, ROWN, 'r', '-' };
atoi.$O\
cleanname.$O\
create.$O\
+ ctime.$O\
dirfstat.$O\
dirfwstat.$O\
dirstat.$O\
--- /dev/null
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#define NOPLAN9DEFINES
+#include <u.h>
+#include <libc.h>
+
+char*
+p9ctime(long t)
+{
+ static char buf[100];
+ time_t tt;
+ struct tm *tm;
+
+ tt = t;
+ tm = localtime(&tt);
+ snprint(buf, sizeof buf, "%3.3s %3.3s %02d %02d:%02d:%02d %3.3s %d\n",
+ "SunMonTueWedThuFriSat"+(tm->tm_wday*3),
+ "JanFebMarAprMayJunJulAugSepOctNovDec"+(tm->tm_mon*3),
+ tm->tm_mday,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec,
+ tm->tm_zone,
+ tm->tm_year + 1900);
+ return buf;
+}