English
Forum

windows System-Time settle

 

maroro
i want at started the Rechners this on one of another computer ausgelesene Time settle.
the here: [...] 
not working.

here the View source:
Declare Tim#,WoTag$[7],d!,where%
Declare rt$,revt$
Def Lese_Datum(1)  ! "Kernel32", "GetSystemTime"
Def Setze_Datum(1) ! "Kernel32", "SetSystemTime"
' SYSTEMTIME - structure. uses becomes Tim#
'    WORD Tim#,0   year
'    WORD Tim#,2  month
'    WORD Tim#,4  week-day 0= sunday, 1= monday ... 6= saturday
'    WORD Tim#,6  day
'    WORD Tim#,8  hour
'    WORD Tim#,10 Minute
'    WORD Tim#,12 second
'    WORD Tim#,14 Millisekunde
' initialisieren Wochentagsarray
WoTag$[0] = "Sonntag"
WoTag$[1] = "Montag"
WoTag$[2] = "Dienstag"
WoTag$[3] = "Mittwoch"
WoTag$[4] = "Donnerstag"
WoTag$[5] = "Freitag"
WoTag$[6] = "Samstag"
Dim Tim#,16
cls
'Time read
rt$ = Remotetime("PC")
revt$ = dt("DateTimeStr","c")

if Len(trim$(rt$)) = 0

    Print "Fehler"

else

    if rt$ = revt$

        print "OK"

    else

        Print "Zeit setzen"
        'Time settle
        Print "Remote:  "+rt$
        Print "Lokal: "+revt$
        '   Print substr$(substr$(rt$,3,"."),1," ")'year
        '   Print substr$(rt$,2,".")'month
        '   Print substr$(rt$,1,".")'day
        '   Print substr$(substr$(rt$,2," "),1,":")'hour
        '   Print substr$(rt$,2,":")'Minute
        '   Print substr$(rt$,3,":")'second
        d! = dt("setDateTime", substr$(substr$(rt$,3,"."),1," "), substr$(rt$,2,"."), substr$(rt$,1,"."), substr$(substr$(rt$,2," "),1,":"), substr$(rt$,2,":"), substr$(rt$,3,":"), 0)
        where% = dt("getDoW", d!)'week-day one Zeitpunktes
        case where% = 7 : where% = 0
        Word Tim#,0 = substr$(substr$(rt$,3,"."),1," ")'year
        Word Tim#,2 = substr$(rt$,2,".")'month
        Word Tim#,4 = st$(where%)
        Word Tim#,6 = substr$(rt$,1,".")'day
        Word Tim#, 8 = substr$(substr$(rt$,2," "),1,":")'hour
        Word Tim#,10 = substr$(rt$,2,":")'Minute
        Word Tim#,12 = substr$(rt$,3,":")'second
        '@Lese_Datum(Tim#)
        ' drucke day
        Print Wotag$[@Word(Tim#,4)],@Word(Tim#,6);".";@Word(Tim#,2);".";@Word(Tim#,0)
        ' drucke Uhrzeit
        Print @Word(Tim#,8);":";@Word(Tim#,10);":";@Word(Tim#,12)

        ifnot  Val(substr$(substr$(rt$,3,"."),1," ")) < 2018

            Print "setze Zeit"
            @Setze_Datum(Tim#)

        endif

        Print "Lokal: "+dt("DateTimeStr","c")

    endif

endif

' if date/Time staid go should: values in Tim# properly settle and
' @Setze_Datum(Tim#)
' perform
waitinput
Dispose Tim#
End

Proc Remotetime

    parameters computername$
    Declare Time$,exc%
    ClearClip
    exc% = winExec(getEnv$("COMSPEC")+" /c net time \\\\"+computername$+ "  | clip ",0)

    while @GetExitCode(exc%) > 0

        ' Sleep 1

    endwhile

    Time$ = GetClip$()
    Time$ = Mid$(Time$,26+Len(computername$),19)
    'Print Time$
    return time$

endproc


would beautiful if here someone a idea has Why not functions. means It's all right only mere around the settle the Time everything else functions.

greetings Maroro
 
04/13/18  
 




Georg
Teles
means by me functions, instead of Get/SetSystemTime is too Get/SetLocalTime appropriate to actually Zeitzone
'Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) into Babyklappe on XProfan.com stored:
'System-Date and System-Time reading and settle
'example reading and settle System-Date and System-Time. for Profan 6.6.
'Version 1.0  13.6.2004.      the Program can spare using go, for
'Schäden can no Liability übernommen go.
'Author: Gerhard Putschalka
'email: g.putschalka@web.de
'homepage: https://members.telering.at/g.putschalka/index.html
Declare Tim#,WoTag$[7]
Def Lese_Datum(1)!"Kernel32","GetSystemTime"
Def Setze_Datum(1)!"Kernel32","SetSystemTime"
'----------# expansion
Declare Azz#
Def Lese_Datum_AktuelleZeitzone(1)!"Kernel32","GetLocalTime"
Def Setze_Datum_AktuelleZeitzone(1)!"Kernel32","SetLocalTime"
'actually Zeitzone - structure.
'WORD Azz#,0  'year
'WORD Azz#,2  'month
'WORD Azz#,4  'week-day
'WORD Azz#,6  'day
'WORD Azz#,8  'hour
'WORD Azz#,10 'Minute
'WORD Azz#,12 'second
'WORD Azz#,14 'Millisekunde
Dim Azz#,16
Lese_Datum_AktuelleZeitzone(Azz#)
'----------# expansion ENDE
'SYSTEMTIME - structure. uses becomes Tim#
'WORD Tim#,0  'year
'WORD Tim#,2  'month
'WORD Tim#,4  'week-day 0= sunday, 1= monday ... 6= saturday
'WORD Tim#,6  'day
'WORD Tim#,8  'hour
'WORD Tim#,10 'Minute
'WORD Tim#,12 'second
'WORD Tim#,14 'Millisekunde
'initialisieren Wochentagsarray
WoTag$[0] = "Sonntag"
WoTag$[1] = "Montag"
WoTag$[2] = "Dienstag"
WoTag$[3] = "Mittwoch"
WoTag$[4] = "Donnerstag"
WoTag$[5] = "Freitag"
WoTag$[6] = "Samstag"
Dim Tim#,16
Lese_Datum(Tim#)
'drucke day
Print Wotag$[Word(Tim#,4)],Word(Tim#,6),Word(Tim#,2),Word(Tim#,0)
'Print Wotag$[]
'drucke Uhrzeit
Print Word(Tim#,8),Word(Tim#,10),Word(Tim#,12)
'if date/Time staid go should: values in Tim# properly settle and
'Setze_Datum(Tim#)
'perform
'----------# expansion Integration
'drucke day
Print Wotag$[Word(Azz#,4)],Word(Azz#,6),Word(Azz#,2),Word(Azz#,0)
'drucke Uhrzeit
Print Word(Azz#,8),Word(Azz#,10),Word(Azz#,12)
'if date/Time staid go should: values in Azz# properly settle and
Word azz#,0 = 2017'example year To 2017 Change
Setze_Datum_AktuelleZeitzone(Azz#)
'perform
'----------# expansion Integration ENDE
Waitinput
Dispose Tim#
Dispose Azz#
End

so the settle funktoniert must to the Program with Admin-Rechten started, then works it

be with RemotePC überfordert, Have unfortunately none parat sry :/

Regards Georg
 
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

04/13/18  
 




Georg
Teles
I have time own PC as Remote registered and it has worked - whom code something sortiert, as Test +5 minutes the own Time registered - moreover have I Get/SetSystemTime To Get/SetLocalTime changed
Declare Tim#,WoTag$[7],d!,where%
Declare rt$,revt$
Def Lese_Datum(1)  ! "Kernel32", "GetLocalTime"
Def Setze_Datum(1) ! "Kernel32", "SetLocalTime"
' SYSTEMTIME - structure. uses becomes Tim#
'    WORD Tim#,0   year
'    WORD Tim#,2  month
'    WORD Tim#,4  week-day 0= sunday, 1= monday ... 6= saturday
'    WORD Tim#,6  day
'    WORD Tim#,8  hour
'    WORD Tim#,10 Minute
'    WORD Tim#,12 second
'    WORD Tim#,14 Millisekunde
' initialisieren Wochentagsarray
WoTag$[0] = "Sonntag"
WoTag$[1] = "Montag"
WoTag$[2] = "Dienstag"
WoTag$[3] = "Mittwoch"
WoTag$[4] = "Donnerstag"
WoTag$[5] = "Freitag"
WoTag$[6] = "Samstag"
Dim Tim#,16
cls
Declare y$,m$,d$,h$,n$,s$
'Time read
rt$ = Remotetime("PC")
revt$ = dt("DateTimeStr","c")

if Len(trim$(rt$)) = 0

    Print "Fehler"

else

    if rt$ = revt$

        'print "OK" 'to that testing ausgeblendet
        'else 'to that testing ausgeblendet
        Print "Zeit setzen"
        'Time settle
        Print "Remote:  "+rt$
        Print "Lokal: "+revt$
        '   Print substr$(substr$(rt$,3,"."),1," ")'year
        '   Print substr$(rt$,2,".")'month
        '   Print substr$(rt$,1,".")'day
        '   Print substr$(substr$(rt$,2," "),1,":")'hour
        '   Print substr$(rt$,2,":")'Minute
        '   Print substr$(rt$,3,":")'second
        y$ = substr$(substr$(rt$,3,"."),1," ")
        m$ = substr$(rt$,2,".")
        d$ = substr$(rt$,1,".")
        h$ = substr$(substr$(rt$,2," "),1,":")
        'n$ = substr$(rt$,2,":") 'original
        n$ = st$(Val(substr$(rt$,2,":"))+5)'as Test +5 minutes
        s$ = substr$(rt$,3,":")
        d! = dt("setDateTime",y$,m$,d$,h$,n$,s$,0)
        where% = dt("getDoW", d!)'week-day one Zeitpunktes
        case where% = 7 : where% = 0
        Word Tim#,0 = y$
        Word Tim#,2 = m$
        Word Tim#,4 = st$(where%)
        Word Tim#,6 = d$
        Word Tim#, 8 = h$
        Word Tim#,10 = n$
        Word Tim#,12 = s$
        '@Lese_Datum(Tim#)
        ' drucke day
        Print Wotag$[@Word(Tim#,4)],@Word(Tim#,6);".";@Word(Tim#,2);".";@Word(Tim#,0)
        ' drucke Uhrzeit
        Print @Word(Tim#,8);":";@Word(Tim#,10);":";@Word(Tim#,12)

        ifnot  Val(substr$(substr$(rt$,3,"."),1," ")) < 2018

            Print "setze Zeit"
            @Setze_Datum(Tim#)

        endif

        Print "Lokal: "+dt("DateTimeStr","c")

    endif

endif

' if date/Time staid go should: values in Tim# properly settle and
' @Setze_Datum(Tim#)
' perform
waitinput
Dispose Tim#
End

Proc Remotetime

    parameters computername$
    Declare Time$,exc%
    ClearClip
    exc% = winExec(getEnv$("COMSPEC")+" /c net time \\\\"+computername$+ "  | clip ",0)

    while @GetExitCode(exc%) > 0

        ' Sleep 1

    endwhile

    Time$ = GetClip$()
    Time$ = Mid$(Time$,26+Len(computername$),19)
    'Print Time$
    return time$

endproc


Regards
 
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

04/13/18  
 




maroro
Yes so functions it ...many Thanks
 
04/14/18  
 




Georg
Teles
very well
 
XProfan X3
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

04/14/18  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.680 Views

Untitledvor 0 min.
E.T.05/21/22
Stringray01/05/22
Klaus Müller08/29/19
Matzbub06/03/19
More...

Themeninformationen

this Topic has 2 subscriber:

Georg Teles (3x)
maroro (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie