Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Altenatve zur Unixtimeumberechnung
#6
(29.11.2018, 16:14)Anachron schrieb: Wäre schön gewesen, wenn du deine Lösung auch der Allgemeinheit mitgeteilt hättest.Dodgy


Code:
string uUnix2StampLst( integer vIntDat ){
//    if (vIntDat / 2145916800){
//        vIntDat = 2145916800 * (1 | vIntDat >> 31);
//    }
//    integer vIntYrs = 1970 + ((((vIntDat %= 126230400) >> 31) + vIntDat / 126230400) << 2);
//    vIntDat -= 126230400 * (vIntDat >> 31);
//    integer vIntDys = vIntDat / 86400;
//    list vLstRtn0 = [vIntDat % 86400 / 3600];
//    list vLstRtn1 = [vIntDat % 3600 / 60];
//    list vLstRtn2 = [vIntDat % 60];
//    
//
//    if (789 == vIntDys){
//        vIntYrs += 2;
//        vIntDat = 2;
//        vIntDys = 29;
//    }else{
//        vIntYrs += (vIntDys -= (vIntDys > 789)) / 365;
//        vIntDys %= 365;
//        vIntDys += vIntDat = 1;
//        integer vIntTmp;
//        while (vIntDys > (vIntTmp = (30 | (vIntDat & 1) ^ (vIntDat > 7)) - ((vIntDat == 2) << 1))){
//            ++vIntDat;
//            vIntDys -= vIntTmp;
//        }
//    }
//   // return [vIntYrs, vIntDat, vIntDys] + vLstRtn;
// OS Part start    

    string OS_Correctur = (string)osUnixTimeToTimestamp((integer) vIntDat );
    list TimeStamp = llParseString2List(OS_Correctur,["-",":"],["T"]);
    integer vIntYrs = llList2Integer(TimeStamp, 0 );
    vIntDat = llList2Integer(TimeStamp, 1 );
    integer vIntDys = llList2Integer(TimeStamp, 2 );
    list vLstRtn0 = [llList2Integer(TimeStamp, 4 )];
    list vLstRtn1 = [llList2Integer(TimeStamp, 5 )];
    list vLstRtn2 = [llList2Integer(TimeStamp, 6 )];
// OS Part end    
    string out = (string)vIntYrs +"-"+ (string) vIntDat +"-"+ (string) vIntDys +"-"+ (string)vLstRtn0 +"-"+ (string)vLstRtn1 +"-"+ (string)vLstRtn2;
   return (string)out ;
}
Zitieren


Nachrichten in diesem Thema
RE: Altenatve zur Unixtimeumberechnung - von brenner23 - 29.11.2018, 16:59

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste