diff options
| author | Kevin B Kenny <kennykb@acm.org> | 2004-10-21 03:53:03 (GMT) | 
|---|---|---|
| committer | Kevin B Kenny <kennykb@acm.org> | 2004-10-21 03:53:03 (GMT) | 
| commit | 0e16d1cc7dd629f7bb9a3d1af174b072e9c8ae6c (patch) | |
| tree | 7f3016e32458ec2688cfc76dc6342bd0b2097191 /generic/tclClock.c | |
| parent | 02b44df49ea3df0256e9e7b48d0f45f29840defe (diff) | |
| download | tcl-0e16d1cc7dd629f7bb9a3d1af174b072e9c8ae6c.zip tcl-0e16d1cc7dd629f7bb9a3d1af174b072e9c8ae6c.tar.gz tcl-0e16d1cc7dd629f7bb9a3d1af174b072e9c8ae6c.tar.bz2  | |
doubled speed of clock format
Diffstat (limited to 'generic/tclClock.c')
| -rw-r--r-- | generic/tclClock.c | 49 | 
1 files changed, 48 insertions, 1 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index e30760b..68b7142 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -12,7 +12,7 @@   * See the file "license.terms" for information on usage and redistribution   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.   * - * RCS: @(#) $Id: tclClock.c,v 1.34 2004/09/27 14:31:17 kennykb Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.35 2004/10/21 03:53:04 kennykb Exp $   */  #include "tclInt.h" @@ -47,6 +47,53 @@ static struct tm* ThreadSafeLocalTime _ANSI_ARGS_(( CONST time_t* ));  static void TzsetIfNecessary _ANSI_ARGS_(( void ));  /* + *---------------------------------------------------------------------- + * + * TclClockGetenvObjCmd -- + * + *	Tcl command that reads an environment variable from the system + * + * Usage: + *	::tcl::clock::getEnv NAME + * + * Parameters: + *	NAME - Name of the environment variable desired + * + * Results: + *	Returns a standard Tcl result.  Returns an error if the + *	variable does not exist, with a message left in the interpreter. + *	Returns TCL_OK and the value of the variable if the variable + *	does exist, + * + *---------------------------------------------------------------------- + */ + +int +TclClockGetenvObjCmd( ClientData clientData, +		      Tcl_Interp* interp, +		      int objc, +		      Tcl_Obj *CONST objv[] ) +{ + +    CONST char* varName; +    CONST char* varValue; +    if ( objc != 2 ) { +	Tcl_WrongNumArgs( interp, 1, objv, "name" ); +	return TCL_ERROR; +    } +    varName = Tcl_GetStringFromObj( objv[1], NULL ); +    varValue = getenv( varName ); +    if ( varValue == NULL ) { +	Tcl_SetObjResult( interp, +			  Tcl_NewStringObj( "variable not found", -1 ) ); +	return TCL_ERROR; +    } else { +	Tcl_SetObjResult( interp, Tcl_NewStringObj( varValue, -1 ) ); +	return TCL_OK; +    } +} + +/*   *-------------------------------------------------------------------------   *   * TclClockLocaltimeObjCmd --  | 
