| |
|
|
p.specht
| Unixtime ============ The Unixtime begins as Sekundenzähler with 0 on the thursday, the 1. january 1970 circa 00:00 watch UTC. Please To mind, that we UTC+1 in the winter and UTC+2 in the Sommerzeit having. The spending with the conversion becomes therefore properly the Zeitzone and period anzupassen his. The conversion becomes integrally official therefore relieved, that Schaltsekunden not mitgezählt go (These should Yes The deviation the Erdrotation a steady durchlaufenden Time correct).
the festgelegte Startdatum becomes too as Epoch marks, what with 32bit-system important go becomes, because 2038 will for Unix vaguely the repeat, what with windows already as year-2000-trouble famous watts.
In actually versions of XProfan can the everything eleganter solve. for XProfan 11.2 free was The fountain: Wikipedia "Unixtime" (Java-Beispielcode). One explicit flotteres, in Assembler geschriebenes Unixtime-Program of M. Wodrich there here in the Board; too Dieter Zornow has with the trouble engage.
Window Title "Konverter Lesbare Zeitangabe To Unixtime (second 0 = Do,1.1.1970 00:00 UTC (then GMT)"
'Vgl:https://www.unixtimestamp.de , www.pagerenk.de/More-informationen/tools/timestampconverter.htm
Window Style 24:Declare Jahr&,Monat&,Tag&,Stunde&,Minute&,Sekunde&,utcdif&,UXTM&:luup:
CLS:print "\n UTC+1\+2h= ";:input utcdif&
Print "\n JJJJ = ";:input Jahr&:Print " month = ";:input Monat&
Print " day = ";:input Tag&:Print " hours = ";:input Stunde&
Print " minutes = ";:input Minute&:print " sec = ";:input Sekunde&
UXTM&=Readable2Unixtime(Jahr&,Monat&,Tag&,Stunde&,Minute&,Sekunde&,utcdif&)
locate 12,12:font 2:if (UXTM&<>-1) and (UXTM&<>-2):print UXTM&
clearclip:putclip st$(UXTM&):font 2:print:print "\n ... too in Clipboard."
else:beep:print "E R R O R ";UXTM&:Endif:font 0
waitinput:waitinput:goto "luup"
Proc Readable2Unixtime' Converts gegliederte UTC-indicated to Unix-sec
parameters Jahr&,Monat&,Tag&,Stunde&,Minute&,Sekunde&,utcdif&' GETESTET, ABER OHNE EACH GEWÄHR!
case (jahr&<1970) or (jahr&>2038) or (monat&>12) or (monat&<1) or (tag&<1) or (tag&>31):return -1
case (Stunde&>23) or (Minute&>59) or (Sekunde&>59) :return -2
declare tage_seit_jahresanfang$[],istschaltjahr&,schaltjahre&,tage_seit_1970&
'Number of days since beginning of the year without days the current month's and without Schalttag:
tage_seit_jahresanfang$[]=explode("0,31,59,90,120,151,181,212,243,273,304,334",",")
' Number of Schaltjahre since 1970 without one evtl. straight current leap-year
schaltjahre& = ((jahr&-1)-1968)/4 - ((jahr&-1)-1900)/100 + ((jahr&-1)-1600)/400
tage_seit_1970&=(jahr&-1970)*365+schaltjahre&+val(tage_seit_jahresanfang$[monat&-1])+tag&-1
if (jahr& mod 4)=0: istschaltjahr&=1:if (jahr& mod 100)=0: istschaltjahr&=0
case (jahr& mod 400)=0: istschaltjahr&=1
endif:endif' Schalttage+1, if angefragte Jahrs leap-year and deadline to february:
case (monat&>2) and istschaltjahr&: inc tage_seit_1970&
return int(sekunde&+60*(minute&+60*(stunde&+24*tage_seit_1970&))-utcdif&*3600)
endproc
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/20/21 ▲ |
|
|
|