using System; namespace BCG { public class MSecondStream : TimeUnitStream { public MSecondStream(int intervalInms, int size) : base(DateTime.Now, new TimeSpan(0, 0, 0, 0, intervalInms), size, ViewStreamDatabase.instance) { } protected override DateTime myRoundTime(DateTime dt) { return dt; } } public class DisplayableMillisecondStream : ViewStream, IStreamMapper { private IBlueTableSchema mySchema = new BlueTableSchema("ms", new ColumnInfo("id", 0, typeof(int)), new ColumnInfo("time", 1, typeof(string))); public DisplayableMillisecondStream(int intervalInMs, int sz) { mySetRealSource(new MapStream(new MSecondStream(intervalInMs, sz), this)); } #region IStreamMapper Members public IBlueTableSchema getOutputSchema(IBlueTableSchema inputSchema) { return mySchema; } #endregion #region IDynamicStreamMapper Members public IBlueRow map(IBlueRow row) { DateTime time = row.get_datetime("time"); var time_txt = time.ToString("yyyy-MM-dd HH:mm:ss.fff"); return new BlueRow(mySchema, row["id"], time_txt); } #endregion private string myToString(DateTime dt) { string sep = ":"; return dt.Hour + sep + dt.Minute + sep + dt.Second + sep + dt.Millisecond; } } }