Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- namespace System
- {
- public struct Time64
- {
- public static readonly Time64 NULL = new Time64(0);
- private int int_0;
- private static uint uint_0;
- public static Time64 Now
- {
- get
- {
- return Time64.timeGetTime();
- }
- }
- public int TotalMilliseconds
- {
- get
- {
- return this.int_0;
- }
- }
- public int Value
- {
- get
- {
- return this.int_0;
- }
- }
- static Time64()
- {
- }
- public Time64(int Value)
- {
- this.int_0 = Value;
- }
- public Time64(uint Value)
- {
- this.int_0 = (int)Value;
- }
- public Time64(long Value)
- {
- this.int_0 = (int)Value;
- }
- public static bool operator ==(Time64 t1, Time64 t2)
- {
- return t1.int_0 == t2.int_0;
- }
- public static bool operator !=(Time64 t1, Time64 t2)
- {
- return t1.int_0 != t2.int_0;
- }
- public static bool operator >(Time64 t1, Time64 t2)
- {
- return t1.int_0 > t2.int_0;
- }
- public static bool operator <(Time64 t1, Time64 t2)
- {
- return t1.int_0 < t2.int_0;
- }
- public static bool operator >=(Time64 t1, Time64 t2)
- {
- return t1.int_0 >= t2.int_0;
- }
- public static bool operator <=(Time64 t1, Time64 t2)
- {
- return t1.int_0 <= t2.int_0;
- }
- public static Time64 operator -(Time64 t1, Time64 t2)
- {
- return new Time64(t1.int_0 - t2.int_0);
- }
- public Time64 AddMilliseconds(int Amount)
- {
- return new Time64(this.int_0 + Amount);
- }
- public int AllMilliseconds()
- {
- return this.GetHashCode();
- }
- public Time64 AddSeconds(int Amount)
- {
- return this.AddMilliseconds(Amount * 1000);
- }
- public int AllSeconds()
- {
- return this.AllMilliseconds() / 1000;
- }
- public Time64 AddMinutes(int Amount)
- {
- return this.AddSeconds(Amount * 60);
- }
- public int AllMinutes()
- {
- return this.AllSeconds() / 60;
- }
- public Time64 AddHours(int Amount)
- {
- return this.AddMinutes(Amount * 60);
- }
- public int AllHours()
- {
- return this.AllMinutes() / 60;
- }
- public Time64 AddDays(int Amount)
- {
- return this.AddHours(Amount * 24);
- }
- public int AllDays()
- {
- return this.AllHours() / 24;
- }
- public bool Next(int due = 0, int time = 0)
- {
- if (time == 0)
- time = Time64.timeGetTime().int_0;
- return this.int_0 + due <= time;
- }
- public void Set(int due, int time = 0)
- {
- if (time == 0)
- time = Time64.timeGetTime().int_0;
- this.int_0 = time + due;
- }
- public void SetSeconds(int due, int time = 0)
- {
- this.Set(due * 1000, time);
- }
- public override bool Equals(object obj)
- {
- if (obj is Time64)
- return (Time64)obj == this;
- else
- return base.Equals(obj);
- }
- public override string ToString()
- {
- return this.int_0.ToString();
- }
- public override int GetHashCode()
- {
- return this.int_0;
- }
- [DllImport("winmm.dll")]
- public static extern Time64 timeGetTime();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement