plan9port/src/libventi/time.c
Dan Cross fa325e9b42 Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines.
Remove blank lines from the ends of files.
Change modes on source files so that they
are not executable.

Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-10 14:54:30 +00:00

28 lines
548 B
C

#include <u.h>
#include <libc.h>
#include <venti.h>
int
vttimefmt(Fmt *fmt)
{
vlong ns;
Tm tm;
if(fmt->flags&FmtSign){
ns = va_arg(fmt->args, long);
ns *= 1000000000;
} else
ns = nsec();
tm = *localtime(ns/1000000000);
if(fmt->flags&FmtLong){
return fmtprint(fmt, "%04d/%02d%02d %02d:%02d:%02d.%03d",
tm.year+1900, tm.mon+1, tm.mday,
tm.hour, tm.min, tm.sec,
(int)(ns%1000000000)/1000000);
}else{
return fmtprint(fmt, "%04d/%02d%02d %02d:%02d:%02d",
tm.year+1900, tm.mon+1, tm.mday,
tm.hour, tm.min, tm.sec);
}
}