| |
|
|
- Page 1 - |
|
Christian Schneider | GetUnixtime() prepares from the actually System-Time a Unix-Timestamp [...] (sec since 01.01.1970 0:00 watch) ->Rückgabewert: Int
UnixToUTC() GetControlParas (B a Timestamp in UTC-Time [...] -> Parameter: Timestamp (Int) -> Return Value: String (stature: TTMMJJSSmmss)
UnixToLocal() GetControlParas (B a Timestamp in local System-Time -> Parameter: Timestamp (Int) -> Return Value: String (stature: TTMMJJSSmmss) CompileMarkSeparationDefinitionen
Def GetSystemTime(1) !"Kernel32.dll","GetSystemTime"
Def SystemTimeToTzSpecificLocalTime(3) !"Kernel32.dll","SystemTimeToTzSpecificLocalTime"
Programm start
CLS
var timestamp% = GetUnixtime()
Print "Timestamp: "+str$(timestamp%)
var time_utc$ = UnixToUTC(timestamp%)
Print "UTC-Zeit: "+left$(time_utc$,2)+"."+mid$(time_utc$,3,2)+"."+mid$(time_utc$,5,4)+" - "+mid$(time_utc$,9,2)+":"+mid$(time_utc$,11,2)+":"+mid$(time_utc$,13,2)
var time_lokal$ = UnixToLocal(timestamp%)
Print "Lokalzeit: "+left$(time_lokal$,2)+"."+mid$(time_lokal$,3,2)+"."+mid$(time_lokal$,5,4)+" - "+mid$(time_lokal$,9,2)+":"+mid$(time_lokal$,11,2)+":"+mid$(time_lokal$,13,2)
Waitkey
Programm ende
Proc GetUnixtime
Declare SYSTEMTIME#
Dim SYSTEMTIME#,16
Declare ut_Jahr%,ut_Monat%,ut_Tag%,ut_Stunde%,ut_Minute%,ut_Sekunde%
var ut_schalttag%=0
Declare tage_bis_monatsanfang%[12]
tage_bis_monatsanfang%[0]=0
tage_bis_monatsanfang%[1]=0
tage_bis_monatsanfang%[2]=31
tage_bis_monatsanfang%[3]=59
tage_bis_monatsanfang%[4]=90
tage_bis_monatsanfang%[5]=120
tage_bis_monatsanfang%[6]=151
tage_bis_monatsanfang%[7]=181
tage_bis_monatsanfang%[8]=212
tage_bis_monatsanfang%[9]=243
tage_bis_monatsanfang%[10]=273
tage_bis_monatsanfang%[11]=304
tage_bis_monatsanfang%[12]=334
GetSystemTime(SYSTEMTIME#)
ut_Jahr%=@Word(SYSTEMTIME#,0)
ut_Monat%=@Word(SYSTEMTIME#,2)
ut_Tag%=@Word(SYSTEMTIME#,6)
ut_Stunde%=@Word(SYSTEMTIME#,8)
ut_Minute%=@Word(SYSTEMTIME#,10)
ut_Sekunde%=@Word(SYSTEMTIME#,12)
if (ut_monat%>2) & (ut_jahr% MOD 4 =0) & (ut_jahr% MOD 100 <> 0)
ut_schalttag%=1
elseif (ut_monat%>2) & (ut_jahr% MOD 400 = 0)
ut_schalttag%=1
endif
DISPOSE SYSTEMTIME#
Return ((tage_bis_monatsanfang%[ut_Monat%]*24*60*60) + (ut_Tag%-1)*24*60*60)+ (ut_Sekunde% + ut_Minute%*60 + ut_Stunde%*60*60) + ((ut_Jahr%-1970) * 365 * 24*60*60 + ((((ut_Jahr%-1)-1968)4 - ((ut_Jahr%-1)-1900)100 + ((ut_Jahr%-1)-1600)400)*24*60*60))+(ut_schalttag%*24*60*60)
Endproc
Proc UnixToUTC
Parameters ut_timestamp%,ut_mode%
Declare ut_schaltjahr%,ut_schalttage%,ut_wochentag%
Declare ut_jahr%,ut_monat%,ut_tag%,ut_stunde%,ut_minute%,ut_sekunde%
if ut_mode%=1
select ((ut_timestamp% 86400) mod 7)
caseof 1 Freitag
ut_wochentag%=5
caseof 2 Samstag
ut_wochentag%=6
caseof 3 Sonntag
ut_wochentag%=0
caseof 4 Montag
ut_wochentag%=1
caseof 5 Dienstag
ut_wochentag%=2
caseof 6 Mittwoch
ut_wochentag%=3
caseof 7 Donnerstag
ut_wochentag%=4
endselect
endif
ut_jahr%=ut_timestamp% (365*24*60*60) + 1970
ut_schalttage%=(((ut_Jahr%-1)-1968)4 - ((ut_Jahr%-1)-1900)100 + ((ut_Jahr%-1)-1600)400)
while (ut_timestamp%-(((ut_jahr%-1970)*365+ut_schalttage%)*24*60*60)+3600) < 0
case (ut_timestamp%-(((ut_jahr%-1970)*365+ut_schalttage%)*24*60*60)+3600) < 0:ut_jahr%=ut_jahr%-1
endwhile
if (ut_jahr% MOD 4 =0) & (ut_jahr% MOD 100 <> 0)
ut_schaltjahr%=1
elseif (ut_jahr% MOD 400 = 0)
ut_schaltjahr%=1
endif
ut_timestamp%=(ut_timestamp%-(((ut_jahr%-1970)*365+ut_schalttage%)*24*60*60))
Select (ut_timestamp% (24*60*60) + 1)
CaseOF > 334+ut_schaltjahr%
ut_monat%=12
ut_timestamp%=ut_timestamp%-((334+ut_schaltjahr%)*24*60*60)
CaseOF > 304+ut_schaltjahr%
ut_monat%=11
ut_timestamp%=ut_timestamp%-((304+ut_schaltjahr%)*24*60*60)
CaseOF > 273+ut_schaltjahr%
ut_monat%=10
ut_timestamp%=ut_timestamp%-((273+ut_schaltjahr%)*24*60*60)
CaseOF > 243+ut_schaltjahr%
ut_monat%=9
ut_timestamp%=ut_timestamp%-((243+ut_schaltjahr%)*24*60*60)
CaseOF > 212+ut_schaltjahr%
ut_monat%=8
ut_timestamp%=ut_timestamp%-((212+ut_schaltjahr%)*24*60*60)
CaseOF > 181+ut_schaltjahr%
ut_monat%=7
ut_timestamp%=ut_timestamp%-((181+ut_schaltjahr%)*24*60*60)
CaseOF > 151+ut_schaltjahr%
ut_monat%=6
ut_timestamp%=ut_timestamp%-((151+ut_schaltjahr%)*24*60*60)
CaseOF > 120+ut_schaltjahr%
ut_monat%=5
ut_timestamp%=ut_timestamp%-((120+ut_schaltjahr%)*24*60*60)
CaseOF > 90+ut_schaltjahr%
ut_monat%=4
ut_timestamp%=ut_timestamp%-((90+ut_schaltjahr%)*24*60*60)
CaseOF > 59+ut_schaltjahr%
ut_monat%=3
ut_timestamp%=ut_timestamp%-((59+ut_schaltjahr%)*24*60*60)
CaseOF > 31
ut_monat%=2
ut_timestamp%=ut_timestamp%-(31*24*60*60)
Otherwise
ut_monat%=1
Endselect
ut_tag% = ut_timestamp% (24*60*60) + 1
ut_timestamp% = (ut_timestamp%-((ut_tag%-1) * 24*60*60))
ut_stunde% = ut_timestamp% (60*60)
ut_timestamp% = (ut_timestamp%-((ut_stunde%)*60*60))
ut_minute% = ut_timestamp% 60
ut_timestamp% = (ut_timestamp%-((ut_minute%)*60))
ut_sekunde% = ut_timestamp%
ifnot ut_mode%=1
Return @If(ut_tag%<10,"0","")+str$(ut_tag%)+@If(ut_monat%<10,"0","")+str$(ut_monat%)+str$(ut_jahr%)+@If(ut_stunde%<10,"0","")+ str$(ut_stunde%)+@If(ut_minute%<10,"0","")+str$(ut_minute%)+@If(ut_sekunde%<10,"0","")+str$(ut_sekunde%)
else
Return str$(ut_jahr%)+@If(ut_monat%<10,"0","")+str$(ut_monat%)+str$(ut_wochentag%)+@If(ut_tag%<10,"0","")+str$(ut_tag%)+@If(ut_stunde%<10,"0","")+str$(ut_stunde%)+@If(ut_minute%<10,"0","")+str$(ut_minute%)+@If(ut_sekunde%<10,"0","")+str$(ut_sekunde%)
EndIF
Endproc
Proc UnixToLocal
Parameters u2l%
Declare SYSTEMTIME#,SYSTEMTIME2#,u2l_return$
Dim SYSTEMTIME#,16
Dim SYSTEMTIME2#,16
Declare ut_rückg$
ut_rückg$ = UnixToUTC(u2l%,1)
Word SYSTEMTIME#,0=val(left$(ut_rückg$,4))
Word SYSTEMTIME#,2=val(mid$(ut_rückg$,5,2))
Word SYSTEMTIME#,4=val(mid$(ut_rückg$,7,1))
Word SYSTEMTIME#,6=val(mid$(ut_rückg$,8,2))
Word SYSTEMTIME#,8=val(mid$(ut_rückg$,10,2))
Word SYSTEMTIME#,10=val(mid$(ut_rückg$,12,2))
Word SYSTEMTIME#,12=val(mid$(ut_rückg$,14,2))
Word SYSTEMTIME#,14=1
SystemTimeToTzSpecificLocalTime(0,SYSTEMTIME#,SYSTEMTIME2#)
u2l_return$ = @IF(@Word(SYSTEMTIME2#,6)<10,"0","")+str$(@Word(SYSTEMTIME2#,6))+@IF(@Word(SYSTEMTIME2#,2)<10,"0","")+str$(@Word(SYSTEMTIME2#,2))+str$(@Word(SYSTEMTIME2#,0))+@IF(@Word(SYSTEMTIME2#,8)<10,"0","")+str$(@Word(SYSTEMTIME2#,8))+@IF(@Word(SYSTEMTIME2#,10)<10,"0","")+str$(@Word(SYSTEMTIME2#,10))+@IF(@Word(SYSTEMTIME2#,12)<10,"0","")+str$(@Word(SYSTEMTIME2#,12))
Dispose SYSTEMTIME#,SYSTEMTIME2#
Return u2l_return$
Endproc
|
|
|
| |
|
|
|
| |
|
- Page 1 - |
|
Dieter Zornow | goes unfortunately still not, see Image |
|
|
| Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 05/25/10 ▲ |
|
|
|
|
| Christian tailor, Beitrag=57201, Zeitpunkt=24.05.2010
Michaels code have I zwischenzeitlich too discover, though has me the Assemblerteil successful into getaway beaten ;)
hey, You need still only Print UnixTime() write. ^^
If your UnixToUTC correctly functions, then would I from it later too gladly one native MKTime make and it in XPSE as real function to assimilate. |
|
|
| |
|
|
|
Christian Schneider | Dieter Zornow, Beitrag=57203, Zeitpunkt=25.05.2010
goes unfortunately still not, see Image
I have it by me again under GMT+7 tested, too there funktionierts. ought to means Schonmal not on the Zeitzone lying. I could me theoretical yet present the The Beta possible athwart schießt. Have unfortunately this time The Subscription bleary and can think I first in the running the week so testing. have you time a with 11.2 create exe appended.
Edit: my naturally 11.2 |
|
|
| |
|
|
|
| You mind already at calculate, that 32-bit for a TimeStamp not always wealthy must !? (überschaue I now not)
last attachment functions by me here on one 32-bit-XP-Home correctly. |
|
|
| |
|
|
|
Christian Schneider | iF, Beitrag=57204, Zeitpunkt=25.05.2010
hey, You need still only Print UnixTime() write. ^^
the likes his, but I try shred To avoid, The I not even in the Ansatz understand (Assembler..).
iF, Beitrag=57204, Zeitpunkt=25.05.2010
If your UnixToUTC correctly functions, then would I from it later too gladly one native MKTime make and it in XPSE as real function to assimilate.
will be you there not detain ^^
To to that 19. january 2038 ought to it with 32bit no Problems give. |
|
|
| |
|
|
| |
|
- Page 2 - |
|
|
| >> The I not even in the Ansatz understand (Assembler..).
Nene I faith we talk together past. CompileMarkSeparation ... and the wars already.
there's nothing with Assembler - can simply so write - Please vlt. once try. |
|
|
| |
|
|
|
Christian Schneider | though, thought You refer you on The Codevorlage of Michael. will be I (if I the whole zeitkritischer need ought to) on it get back. |
|
|
| |
|
|
|
| I had Michaels code as Presentation used (if too a couple Changes necessary were) to that installation the function UnixTime [...] as "echte" native function - is How you say for zeitkritische items super or if one these function in Threads/ Callbacks benefit likes. my thought was hold, that You, the Result the a function to that comparison with the Result the others function benefit can. |
|
|
| |
|
|
|
Christian Schneider | have time compared. either goes my Function to 286 sec to, or your to
have now again following Page to that comparison rangezogen: [...] loudly them shining my worth To voices
will be today evening again look where it there u.u. klemmt. |
|
|
| |
|
|
|
| One reason, and so ichs Compare for important hold - somewhere is Yes always one bow. ^^ |
|
|
| |
|
|
|
Dieter Zornow | Yes you're right, it's located on Beta Version of XProfan, have whom code straight time with 11.2 tested, Result shining ok. the must itself too Roland look at, what there in 12 schief runs. |
|
|
| Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 05/25/10 ▲ |
|
|
|
|
RGH | Dieter Zornow, Beitrag=57219, Zeitpunkt=25.05.2010
Yes you're right, it's located on Beta Version of XProfan, have whom code straight time with 11.2 tested, Result shining ok. the must itself too Roland look at, what there in 12 schief runs.
Yes, XProfan 12ß has another trouble, if SELECT on one QuadInt meets. (One Result of/ one ganzzahligen Division is a QuadInt.) Workaround until next Subscriptionsrelease see here: [...]
Greeting Roland |
|
|
| Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 05/26/10 ▲ |
|
|
|