/************************************************************************** * * COPYRIGHT (C) 1996, CiTR * This document is confidential information. * * Produced by: CiTR * * Project: NEC ATM LAN (Phase 4) * * File: ftime.c *$Source$ * * Reference: * * Description: Displays the time in the specified format * * History: * 14-Oct-1996 David & (horton) : created * *$Log$ * *************************************************************************/ #if !defined(lint) static char *rcsid = "@(#)$RCSfile$ $Revision$"; #endif #include #include #include void main(int argc, char *argv[]) { time_t now; char buf[100]; struct tm *tm; if ((argc != 2) && (argc != 3)) { fprintf(stderr,"Usage: %s strftime_format time_as_int\n", argv[0]); exit(1); } if(argc == 3) { now = atoi(argv[2]); } else { now = time(NULL); } tm = localtime(&now); buf[0] = 0; (void) strftime(buf, sizeof(buf), argv[1], tm); printf("%s", buf); exit(0); }