本文整理汇总了C#中DateTime.ToBinary方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.ToBinary方法的具体用法?C# DateTime.ToBinary怎么用?C# DateTime.ToBinary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime
的用法示例。
在下文中一共展示了DateTime.ToBinary方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetLastTime
public void SetLastTime(DateTime in_time)
{
long timeBin = in_time.ToBinary();
m_lastTimePsrt1 = (int)timeBin;
m_lastTimePart2 = (int)(timeBin >> 32);
}
示例2: Start
//public TestClass1 Tester2;
//public List<TestClass1> Tests;
//public List<ITriggerConditionTest> CondTest;
public void Start()
{
//System.DateTime TestTime = new DateTime(2015, 12, 9, 14, 59, 30);
System.DateTime TestTime = new DateTime(2015, 10, 8, 13, 59, 30);
System.DateTime TestNowTime = new DateTime(System.DateTime.Now.Ticks);
Debug.Log("TestTime " + TestTime);
Debug.Log("NowTime " + TestNowTime);
Debug.Log("TestTimeLong " + TestTime.ToBinary());
Debug.Log("NowTimeLong " + TestNowTime.ToBinary());
Debug.Log("timeGap " + (TestTime - TestNowTime));
TimeSpan ts = TestTime - TestNowTime;
Debug.Log("TimeGapDays Long " + ts.Days);
Debug.Log("TimeGapMinutes Long " + ts.Minutes);
Debug.Log("TimeGapTotalMinutes Long " + ts.TotalMinutes);
Debug.Log("TimeGapSeconds Long " + ts.Seconds);
Debug.Log("TimeGapTotalSeconds Long " + ts.TotalSeconds);
// string으로 저장한 다음에 다시 long으로 변환해서 가져오장
// 연.월.일 차이가 없어도 1씩 들어가 있으니까 빼자.
// 빼기는
}
示例3: addEvent
public int addEvent(DateTime startTime,DateTime endTime,string title,int type,string extra,string detail)
{
//create event based on given data
if(detail.Equals(null) && type == null){
Node temp = new Node(title, startTime.ToBinary(), endTime.ToBinary());
}else if(type == null){
Node temp = new Node(title, detail, startTime.ToBinary(), endTime.ToBinary());
}else if(detail.Equals(null)){
Node temp = new Node(title, startTime.ToBinary(), endTime.ToBinary(), type, extra);
}else{
Node temp = new Node(title, detail,startTime.ToBinary(), endTime.ToBinary(), type, extra);
}
//add the event into list sorted by startTime
if(eventList.Count!=0){
int j=0;
LinkedList<Node>.Enumerator e = eventList.GetEnumerator();
while(e.MoveNext() && j!=1){
if(DateTime(e.getStart()) <= DateTime(e.getStart())){
//check the end time
if(!e.checkRepeat(temp.getStart(), temp.getEnd())){
return -1;
}
//add to non-first and non-last point in list
if(DateTime(e.getStart()) != DateTime(eventList.First.getStart())){
temp.addBefore(e);
}else{
//add to first point in list
eventList.addFirst(temp);
}
j=1;
}
}
if(j!=1){
//add to end of list and check the end time
if(!e.checkRepeat(temp.getStart(), temp.getEnd())){
return -1;
}
eventList.AddLast(temp);
}
}else if(eventList.Count==0){
eventList.addFirst(temp);
}
return 1;
}
示例4: BinaryContains
public static Boolean BinaryContains(SqlBytes AData, DateTime AValue)
{
if(AData.IsNull) return false;
System.IO.BinaryReader r = new System.IO.BinaryReader(new System.IO.MemoryStream(AData.Buffer));
#if DEBUG
int LCount = r.ReadInt32();
#else
int LCount = Sql.Read7BitEncodedInt(r);
#endif
Int64 LValue = (Int64)AValue.ToBinary();
for(; LCount > 0; LCount--)
if(r.ReadInt64() == LValue) return true;
return false;
}
示例5: WriteDateTimeText
public override void WriteDateTimeText(DateTime dt)
{
WriteTextNodeWithInt64(XmlBinaryNodeType.DateTimeText, dt.ToBinary());
}