Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

TimeAtofCommand Class Reference

Inheritance diagram for TimeAtofCommand:

Inheritance graph
[legend]
Collaboration diagram for TimeAtofCommand:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TimeAtofCommand ()
virtual int command (int argc, const char *const *argv)

Constructor & Destructor Documentation

TimeAtofCommand::TimeAtofCommand  )  [inline]
 

Definition at line 197 of file misc.cc.

References time_atof().

00197 : TclCommand("time_atof") { }

Here is the call graph for this function:


Member Function Documentation

virtual int TimeAtofCommand::command int  argc,
const char *const *  argv
[inline, virtual]
 

Definition at line 198 of file misc.cc.

00198                                                               {
00199                 if (argc != 2)
00200                         return (TCL_ERROR);
00201                 char* s = (char*) argv[1];
00202                 char wrk[32];
00203                 char* cp = wrk;
00204                 while (isdigit(*s) || *s == 'e' ||
00205                        *s == '+' || *s == '-' || *s == '.')
00206                         *cp++ = *s++;
00207                 *cp = 0;
00208                 double v = atof(wrk);
00209                 switch (*s) {
00210                 case 'm':
00211                         v *= 1e-3;
00212                         break;
00213                 case 'u':
00214                         v *= 1e-6;
00215                         break;
00216                 case 'n':
00217                         v *= 1e-9;
00218                         break;
00219                 case 'p':
00220                         v *= 1e-12;
00221                         break;
00222                 }
00223                 Tcl::instance().resultf("%g", v);
00224                 return (TCL_OK);
00225         }


The documentation for this class was generated from the following file:
Generated on Tue Apr 20 13:32:48 2004 for NS2.26SourcesOriginal by doxygen 1.3.3