github.com/shijuvar/go@v0.0.0-20141209052335-e8f13700b70c/src/lib9/ctime.c (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build !plan9 6 7 #define NOPLAN9DEFINES 8 #include <u.h> 9 #include <libc.h> 10 11 char* 12 p9ctime(long t) 13 { 14 static char buf[100]; 15 time_t tt; 16 struct tm *tm; 17 18 tt = t; 19 tm = localtime(&tt); 20 snprint(buf, sizeof buf, "%3.3s %3.3s %02d %02d:%02d:%02d %3.3s %d\n", 21 &"SunMonTueWedThuFriSat"[tm->tm_wday*3], 22 &"JanFebMarAprMayJunJulAugSepOctNovDec"[tm->tm_mon*3], 23 tm->tm_mday, 24 tm->tm_hour, 25 tm->tm_min, 26 tm->tm_sec, 27 "XXX", // tm_zone is unavailable on windows, and no one cares 28 tm->tm_year + 1900); 29 return buf; 30 }