48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
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)
|
|
{
|
|
return new BlueRow (mySchema, row["id"], myToString ((DateTime)row["time"]));
|
|
}
|
|
|
|
#endregion
|
|
|
|
private string myToString (DateTime dt)
|
|
{
|
|
string sep = ":";
|
|
return dt.Hour + sep + dt.Minute + sep + dt.Second + sep + dt.Millisecond;
|
|
}
|
|
}
|
|
}
|