static const char CmdNotExists[] = "!E";
static const char CmdSchema[] = "S";
static const char CmdTake[] = ".";
-static const char CmdTimePrec[] = "TP";
+static const char CmdPrec[] = "P";
static const char CmdType[] = "T";
static const char CmdUTC[] = "UTC";
}
err.code = KEKSSchemaErrNo;
}
- } else if (KEKSStrEqual(&(schema->list[idxSchema].atom), CmdTimePrec)) {
+ } else if (KEKSStrEqual(&(schema->list[idxSchema].atom), CmdPrec)) {
idxSchema = schema->list[idxSchema].next;
if (idxSchema == 0) {
err.code = KEKSSchemaErrInvalidSchema;
err.offSchema = schema->offsets[idxSchema];
if (schema->list[idxSchema].atom.typ != KEKSItemPint) {
err.code = KEKSSchemaErrInvalidSchema;
- err.msg = "non-int TIMEPREC";
+ err.msg = "non-int PREC";
return err;
}
- err.msg = "TIMEPREC";
+ err.msg = "PREC";
err.code = KEKSSchemaErrNo;
if (v != SIZE_MAX) {
if (data->list[v].atom.typ != KEKSItemTAI64) {
break;
default:
err.code = KEKSSchemaErrInvalidSchema;
- err.msg = "unknown TIMEPREC value";
+ err.msg = "unknown PREC value";
return err;
}
}
CmdNotExists = "!E"
CmdSchema = "S"
CmdTake = "."
- CmdTimePrec = "TP"
+ CmdPrec = "P"
CmdType = "T"
CmdUTC = "UTC"
Magic = "schema"
}}
}
}
- case CmdTimePrec:
+ case CmdPrec:
if vs == nil {
continue
}
SCHEMA | ["S", s]
Check chosen (if it exists) element against schema named "s".
-TIMEPREC | ["TP", p]
- Check that chosen (if it exists) element, of time type, has value of
- maximal specified time precision. "p" is integer with following
- possible values:
+PREC | ["P", p]
+ Check that chosen (if it exists) element, has specified precision.
+ It chosen element of time type, then check its value is at most
+ precise as 10^{-p} seconds. "p" is integer with following possible
+ values:
0: only full seconds allowed, no parts;
3: only up to milliseconds;
6: only up to microseconds;
12: only up to picoseconds;
15: only up to femtoseconds;
18: up to attoseconds;
+ If chosen element of float type, then TODO.
UTC | ["UTC"]
Check that chosen (if it exists) element, of TAI type,
"=v" checks that given bin/str/hexlet/magic has specified binary value.
-"prec=p" issues TIMEPREC command, but instead of specifying the raw
-integer values, you choose one of: s, ms, us, ns, ps, fs.
+"prec=p" issues PREC command, but instead of specifying the raw
+integer values, you choose one of: s, ms, us, ns, ps, fs for time type.
"utc" issues UTC command.
proc GT {n} {subst {LIST {{STR >} {INT $n}}}}
proc LT {n} {subst {LIST {{STR <} {INT $n}}}}
proc SCHEMA {s} {subst {LIST {{STR S} {STR $s}}}}
-proc TIMEPREC {p} {subst {LIST {{STR TP} {INT $p}}}}
+proc PREC {p} {subst {LIST {{STR P} {INT $p}}}}
proc UTC {} {return {LIST {{STR UTC}}}}
proc TAKE {k} {
subst {LIST {$l}}
}
-set timeprecArgs [dict create s 0 ms 3 us 6 ns 9 ps 12 fs 15]
+set precArgs [dict create s 0 ms 3 us 6 ns 9 ps 12 fs 15]
proc field {k types args} {
upvar _cmds _cmds buf buf
set i [lsearch -glob $args "prec=*"]
if {$i != -1} {
set p [string range [lindex $args $i] 5 end]
- variable timeprecArgs
- set p [dict get $timeprecArgs $p]
- lappend _cmds [TIMEPREC $p]
+ variable precArgs
+ set p [dict get $precArgs $p]
+ lappend _cmds [PREC $p]
}
if {[lsearch -exact $args utc] != -1} {
lappend _cmds [UTC]
MAP $_pairs
}
-namespace export TAKE EXISTS !EXISTS EACH EQ TYPE GT LT SCHEMA TIMEPREC UTC
+namespace export TAKE EXISTS !EXISTS EACH EQ TYPE GT LT SCHEMA PREC UTC
namespace export do process field
}