| 114 | |
| 115 | |
| 116 | bool MonitoringTableScan::retrieveRecord(thread_db* tdbb, jrd_rel* relation, |
| 117 | FB_UINT64 position, Record* record) const |
| 118 | { |
| 119 | MonitoringSnapshot* const snapshot = MonitoringSnapshot::create(tdbb); |
| 120 | if (!snapshot->getData(relation)->fetch(position, record)) |
| 121 | return false; |
| 122 | |
| 123 | if (relation->rel_id == rel_mon_attachments || relation->rel_id == rel_mon_statements) |
| 124 | { |
| 125 | const USHORT fieldId = (relation->rel_id == rel_mon_attachments) ? |
| 126 | (USHORT) f_mon_att_idle_timer : (USHORT) f_mon_stmt_timer; |
| 127 | |
| 128 | dsc desc; |
| 129 | if (EVL_field(relation, record, fieldId, &desc)) |
| 130 | { |
| 131 | SINT64 clock; |
| 132 | memcpy(&clock, desc.dsc_address, sizeof(clock)); |
| 133 | |
| 134 | ISC_TIMESTAMP_TZ* ts = reinterpret_cast<ISC_TIMESTAMP_TZ*> (desc.dsc_address); |
| 135 | ts->utc_timestamp = TimeZoneUtil::getCurrentGmtTimeStamp().utc_timestamp; |
| 136 | |
| 137 | if (relation->rel_id == rel_mon_attachments) |
| 138 | { |
| 139 | const SINT64 currClock = fb_utils::query_performance_counter() / fb_utils::query_performance_frequency(); |
| 140 | NoThrowTimeStamp::add10msec(&ts->utc_timestamp, clock - currClock, ISC_TIME_SECONDS_PRECISION); |
| 141 | NoThrowTimeStamp::round_time(ts->utc_timestamp.timestamp_time, 0); |
| 142 | } |
| 143 | else |
| 144 | { |
| 145 | const SINT64 currClock = fb_utils::query_performance_counter() * 1000 / fb_utils::query_performance_frequency(); |
| 146 | NoThrowTimeStamp::add10msec(&ts->utc_timestamp, clock - currClock, ISC_TIME_SECONDS_PRECISION / 1000); |
| 147 | } |
| 148 | |
| 149 | // hvlad: this will assign local system (server) time zone that was actual |
| 150 | // when current attachment created. |
| 151 | Attachment* att = tdbb->getAttachment(); |
| 152 | ts->time_zone = att->att_timestamp.time_zone; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | return true; |
| 157 | } |
| 158 | |
| 159 | |
| 160 | // MonitoringData class |
nothing calls this directly
no test coverage detected