/// <summary> /// Gets the value of the specified column as a <see cref="TimeSpan" />. /// </summary> /// <param name="ordinal">The zero-based column ordinal.</param> /// <returns>The value of the column.</returns> public virtual TimeSpan GetTimeSpan(int ordinal) { var val = Marshal.ReadInt64(GetValuePtr(ordinal)); var _dateTimePrecision = (TSDB_TIME_PRECISION)TDengine.ResultPrecision(_taosResult); if (_dateTimePrecision == TSDB_TIME_PRECISION.TSDB_TIME_PRECISION_MICRO) { return(TimeSpan.FromMilliseconds(val / 1000)); } else { return(TimeSpan.FromMilliseconds(val)); } }
private DateTime GetDateTimeFrom(IntPtr data) { var val = Marshal.ReadInt64(data); double tsp; var _dateTimePrecision = (TSDB_TIME_PRECISION)TDengine.ResultPrecision(_taosResult); if (_dateTimePrecision == TSDB_TIME_PRECISION.TSDB_TIME_PRECISION_MICRO) { tsp = (val / 1000); } else { tsp = val; } if (tsp > _date_max_1970) { //fix https://github.com/taosdata/TDengine/issues/3270 tsp /= 1000; } var v9 = _dt1970.AddMilliseconds(tsp); return(v9.ToLocalTime()); }