[chronojump] At trigger changed ms to us to clarify, but not at SQL
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] At trigger changed ms to us to clarify, but not at SQL
- Date: Fri, 19 Mar 2021 12:01:20 +0000 (UTC)
commit 56980f13779dc2ddd0a66232b7020ba9f0b0f198
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Mar 19 12:58:43 2021 +0100
At trigger changed ms to us to clarify, but not at SQL
src/trigger.cs | 41 +++++++++++++++++++++++++----------------
1 file changed, 25 insertions(+), 16 deletions(-)
---
diff --git a/src/trigger.cs b/src/trigger.cs
index 0f87c6d0..a1276faf 100644
--- a/src/trigger.cs
+++ b/src/trigger.cs
@@ -27,19 +27,19 @@ public class Trigger
private int uniqueID;
private Modes mode;
private int modeID;
- private int ms;
+ private int us; //micro seconds
private bool inOut;
private string name;
private string color;
private string comments;
//constructor used on capture
- public Trigger (Modes mode, int ms, bool inOut)
+ public Trigger (Modes mode, int us, bool inOut)
{
this.uniqueID = -1; //will be assigned on SQL insertion
this.mode = mode;
this.modeID = -1; //will be assigned on SQL insertion
- this.ms = ms;
+ this.us = us;
this.inOut = inOut;
this.name = "";
this.color = "";
@@ -47,21 +47,21 @@ public class Trigger
}
//constructor used on loading from SQL
- public Trigger (int uniqueID, Modes mode, int modeID, int ms, bool inOut, string name, string color,
string comments)
+ public Trigger (int uniqueID, Modes mode, int modeID, int us, bool inOut, string name, string color,
string comments)
{
this.uniqueID = uniqueID;
this.mode = mode;
this.modeID = modeID;
- this.ms = ms;
+ this.us = us;
this.inOut = inOut;
this.name = name;
this.color = color;
this.comments = comments;
}
- public void Substract(int msToSubstract)
+ public void Substract(int usToSubstract)
{
- ms -= msToSubstract;
+ us -= usToSubstract;
}
public string ToSQLInsertString()
@@ -74,7 +74,7 @@ public class Trigger
idStr + "," +
"\"" + mode.ToString() + "\"" + "," +
modeID.ToString() + "," +
- ms.ToString() + "," +
+ us.ToString() + "," +
Util.BoolToInt(inOut).ToString() + "," +
"\"" + name.ToString() + "\"" + "," +
"\"" + color.ToString() + "\"" + "," +
@@ -85,19 +85,22 @@ public class Trigger
//used on TextView
public override string ToString()
{
- return ms.ToString() + ", " + Util.BoolToInOut(inOut).ToString();
+ return us.ToString() + ", " + Util.BoolToInOut(inOut).ToString();
}
public int UniqueID {
get { return uniqueID; }
}
- public int Ms {
- get { return ms; }
+ public int Us {
+ get { return us; }
+ }
+ public double Ms {
+ get { return UtilAll.DivideSafe(us, 1000.0); }
}
public bool IsNegative {
- get { return ms < 0; }
+ get { return us < 0; }
}
public bool InOut {
@@ -132,12 +135,12 @@ public class TriggerList
l.Add(trigger);
}
- public void Substract(int msToSubstract)
+ public void Substract(int usToSubstract)
{
//iterate negative to not fail enumeration if an element is substracted
for(int i = l.Count -1 ; i >= 0; i --)
{
- l[i].Substract(msToSubstract);
+ l[i].Substract(usToSubstract);
//triggers cannot be negative
if(l[i].IsNegative)
@@ -145,6 +148,12 @@ public class TriggerList
}
}
+ //used on forceSensorAnalyzeManualGraphDo
+ public List<Trigger> GetList()
+ {
+ return l;
+ }
+
//just to debug
public void Print()
{
@@ -296,9 +305,9 @@ public class TriggerList
! newTrigger.InOut && countOff() == 0) )
return false;
- if(type3 == Type3.BOTH && (newTrigger.Ms - last(Type3.BOTH).Ms) < ms )
+ if(type3 == Type3.BOTH && (newTrigger.Us - last(Type3.BOTH).Us) < ms*1000 )
return true;
- else if(type3 == Type3.ON && (newTrigger.Ms - last(Type3.ON).Ms) < ms )
+ else if(type3 == Type3.ON && (newTrigger.Us - last(Type3.ON).Us) < ms*1000 )
return true;
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]