How database functions determine what t number is?

How such functions as as-of and since which API accepts point t distinguish this ‘t’ value to determine whether it is transaction number or transaction id ?

An entity id long (64 bits signed) consists of 42 least-significant-bits of “t” and 20 more-significant-bits of partition. The difference between a “t” and a “tx” is just the partition bits of a tx. (The partition of a tx is 3)

There are various functions in the peer api which manipulate entity ids:

d/t->tx. Replaces partition bits with partition-3 (tx), keeps t bits the same.

d/tx->t replaces partition bits with partition-0 (same as db partition), keeps t-bits the same.

d/part extracts the partition bits

d/entid-at. Constructs an entity id from partition and t separately. The partition arg can be a raw number or an ident (eg :db.part/tx) and the t arg can be any long or an instant that is resolved to a tx.