

Public Member Functions | |
| TimeAtofCommand () | |
| virtual int | command (int argc, const char *const *argv) |
|
|
Definition at line 197 of file misc.cc. References time_atof().
00197 : TclCommand("time_atof") { } |
Here is the call graph for this function:

|
||||||||||||
|
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 }
|
1.3.3