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