1219089Spjd/* 2219089Spjd * CDDL HEADER START 3219089Spjd * 4219089Spjd * The contents of this file are subject to the terms of the 5219089Spjd * Common Development and Distribution License (the "License"). 6219089Spjd * You may not use this file except in compliance with the License. 7219089Spjd * 8219089Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9219089Spjd * or http://www.opensolaris.org/os/licensing. 10219089Spjd * See the License for the specific language governing permissions 11219089Spjd * and limitations under the License. 12219089Spjd * 13219089Spjd * When distributing Covered Code, include this CDDL HEADER in each 14219089Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15219089Spjd * If applicable, add the following below this CDDL HEADER, with the 16219089Spjd * fields enclosed by brackets "[]" replaced with your own identifying 17219089Spjd * information: Portions Copyright [yyyy] [name of copyright owner] 18219089Spjd * 19219089Spjd * CDDL HEADER END 20219089Spjd */ 21219089Spjd/* 22219089Spjd * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23219089Spjd * Use is subject to license terms. 24219089Spjd */ 25219089Spjd 26219089Spjd#include "statcommon.h" 27219089Spjd 28219089Spjd#include <langinfo.h> 29219089Spjd 30219089Spjd/* 31219089Spjd * Print timestamp as decimal reprentation of time_t value (-T u was specified) 32219089Spjd * or in date(1) format (-T d was specified). 33219089Spjd */ 34219089Spjdvoid 35219089Spjdprint_timestamp(uint_t timestamp_fmt) 36219089Spjd{ 37219089Spjd time_t t = time(NULL); 38219089Spjd 39219089Spjd if (timestamp_fmt == UDATE) { 40219089Spjd (void) printf("%ld\n", t); 41219089Spjd } else if (timestamp_fmt == DDATE) { 42219089Spjd char dstr[64]; 43219089Spjd int len; 44219089Spjd 45219089Spjd len = strftime(dstr, sizeof (dstr), "%+", localtime(&t)); 46219089Spjd if (len > 0) 47219089Spjd (void) printf("%s\n", dstr); 48219089Spjd } 49219089Spjd} 50