xref: /netbsd-src/external/cddl/dtracetoolkit/dist/Include/time.h (revision c29d51755812ace2e87aeefdb06cb2b4dac7087a)
1*c29d5175Schristos /*
2*c29d5175Schristos  * time.h - DTrace Time include file.
3*c29d5175Schristos  *
4*c29d5175Schristos  * $Id: time.h,v 1.1.1.1 2015/09/30 22:01:09 christos Exp $
5*c29d5175Schristos  *
6*c29d5175Schristos  * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
7*c29d5175Schristos  *
8*c29d5175Schristos  * CDDL HEADER START
9*c29d5175Schristos  *
10*c29d5175Schristos  *  The contents of this file are subject to the terms of the
11*c29d5175Schristos  *  Common Development and Distribution License, Version 1.0 only
12*c29d5175Schristos  *  (the "License").  You may not use this file except in compliance
13*c29d5175Schristos  *  with the License.
14*c29d5175Schristos  *
15*c29d5175Schristos  *  You can obtain a copy of the license at Docs/cddl1.txt
16*c29d5175Schristos  *  or http://www.opensolaris.org/os/licensing.
17*c29d5175Schristos  *  See the License for the specific language governing permissions
18*c29d5175Schristos  *  and limitations under the License.
19*c29d5175Schristos  *
20*c29d5175Schristos  * CDDL HEADER END
21*c29d5175Schristos  *
22*c29d5175Schristos  * 16-Sep-2007	Brendan Gregg	Created this.
23*c29d5175Schristos  */
24*c29d5175Schristos 
25*c29d5175Schristos /*
26*c29d5175Schristos  * TIME_HHMMSS - Returns GMT time as a "HH:MM:SS" string.
27*c29d5175Schristos  *
28*c29d5175Schristos  * eg, "21:53:07"
29*c29d5175Schristos  */
30*c29d5175Schristos #define TIME_HHMMSS							\
31*c29d5175Schristos 	strjoin(strjoin(strjoin(strjoin(strjoin(			\
32*c29d5175Schristos 	(((walltimestamp / 1000000000) % 86400) / 3600) < 10 ? "0" : "",\
33*c29d5175Schristos 	lltostr(((walltimestamp / 1000000000) % 86400) / 3600)), ":"),	\
34*c29d5175Schristos 	strjoin((((walltimestamp / 1000000000) % 3600) / 60) < 10 ?	\
35*c29d5175Schristos 	"0" : "", lltostr(((walltimestamp / 1000000000) % 3600) / 60))),\
36*c29d5175Schristos 	":"), strjoin(((walltimestamp / 1000000000) % 60) < 10 ?	\
37*c29d5175Schristos 	"0" : "", lltostr((walltimestamp / 1000000000) % 60)))
38*c29d5175Schristos 
39