(accessor: string)
| 65 | } |
| 66 | |
| 67 | write(accessor: string): string { |
| 68 | const msVar = this.scope.uniqueName("ts_ms"); |
| 69 | const secondsVar = this.scope.uniqueName("ts_sec"); |
| 70 | const nanosVar = this.scope.uniqueName("ts_nanos"); |
| 71 | return ` |
| 72 | const ${msVar} = ${accessor}; |
| 73 | const ${secondsVar} = Math.floor(${msVar} / 1000); |
| 74 | const ${nanosVar} = Math.round((${msVar} - ${secondsVar} * 1000) * 1000000); |
| 75 | ${this.builder.writer.writeVarInt64(`${secondsVar}`)} |
| 76 | ${this.builder.writer.writeInt32(`${nanosVar}`)} |
| 77 | `; |
| 78 | } |
| 79 | |
| 80 | read(accessor: (expr: string) => string): string { |
| 81 | const seconds = this.builder.reader.readVarInt64(); |
nothing calls this directly
no test coverage detected