Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/planix-v0/sys/src/libventi/time.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <venti.h>
4
 
5
int
6
vttimefmt(Fmt *fmt)
7
{
8
	vlong ns;
9
	Tm tm;
10
 
11
	if(fmt->flags&FmtLong){
12
		ns = nsec();
13
		tm = *localtime(ns/1000000000);
14
		return fmtprint(fmt, "%04d/%02d%02d %02d:%02d:%02d.%03d", 
15
			tm.year+1900, tm.mon+1, tm.mday, 
16
			tm.hour, tm.min, tm.sec,
17
			(int)(ns%1000000000)/1000000);
18
	}else{
19
		tm = *localtime(time(0));
20
		return fmtprint(fmt, "%04d/%02d%02d %02d:%02d:%02d", 
21
			tm.year+1900, tm.mon+1, tm.mday, 
22
			tm.hour, tm.min, tm.sec);
23
	}
24
}
25