ToUniversalTime() public method

public ToUniversalTime ( System.DateTime time ) : System.DateTime
time System.DateTime
return System.DateTime
Ejemplo n.º 1
0
    public static double GetSystemDateTimeSec_ByNow(System.DateTime _SpecifiedTime)
    {
        System.DateTime timeStampUTC = m_LocalTimeZone.ToUniversalTime(_SpecifiedTime);
        System.TimeSpan timeSpan     = (timeStampUTC - System.DateTime.Now);
        double          ret          = timeSpan.TotalSeconds;

        return(ret);
    }
Ejemplo n.º 2
0
 static public int ToUniversalTime(IntPtr l)
 {
     try {
         System.TimeZone self = (System.TimeZone)checkSelf(l);
         System.DateTime a1;
         checkValueType(l, 2, out a1);
         var ret = self.ToUniversalTime(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 3
0
    static int ToUniversalTime(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            System.TimeZone obj  = (System.TimeZone)ToLua.CheckObject <System.TimeZone>(L, 1);
            System.DateTime arg0 = StackTraits <System.DateTime> .Check(L, 2);

            System.DateTime o = obj.ToUniversalTime(arg0);
            ToLua.PushValue(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Ejemplo n.º 4
0
        static StackObject *ToUniversalTime_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.DateTime @time = (System.DateTime) typeof(System.DateTime).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.TimeZone instance_of_this_method = (System.TimeZone) typeof(System.TimeZone).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.ToUniversalTime(@time);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Automatics the universal.
 /// </summary>
 /// <param name="local">The local.</param>
 /// <param name="timezone">The timezone.</param>
 /// <param name="min">The minimum.</param>
 /// <param name="max">The maximum.</param>
 /// <returns></returns>
 private static DateTime ToUniversal(DateTime local, TimeZone timezone, DateTime min, DateTime max)
 {
     if (TimeInterval.SaturateDateTime(ref local, min, max))
     {
         return DateTime.SpecifyKind(local, DateTimeKind.Utc);
     }
     return timezone.ToUniversalTime(local);
 }