Shell commands to set the clock
  • Order of the Butterfly
    Order of the Butterfly
    Templario
    Posts: 304 from 2012/4/28
    I want know if there are shell commands to set the clock system, I have on PowerBook without the clock battery and I want make a little tool to set clock when I start the mac, and I need if there is a command of style setclock, etc.
    Amiga 500 with ROMs 1.3-2.05 and M-Tec AT 500 with hard disk and 4MB Ram.
    WinUAE + original OS 3.5&3.9
    Sam440ep 800 MHZ + OS 4.1 F.E.
    Sam460ex 1 GHz + OS 4.1 F.E.
    MacMini 1.5 GHz + MorphOS 3.12
    PowerBook G4 1.65 + MorphOS 3.12
  • »12.11.19 - 09:46
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 1885 from 2003/3/5
    From: Poland
    I'd recommend adding 'setclockntp save' to your user-network-startup file.
  • »12.11.19 - 09:50
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Templario
    Posts: 304 from 2012/4/28
    Thank you for the suggestion, I have it with capital letters the SAVE option, but every time that I start my machine the clock has 1978, and when I click in the clock to set a current date it changes to 1985, I want to have the date of the last time that I started my mac.
    And my idea is make a program to make it.
    Amiga 500 with ROMs 1.3-2.05 and M-Tec AT 500 with hard disk and 4MB Ram.
    WinUAE + original OS 3.5&3.9
    Sam440ep 800 MHZ + OS 4.1 F.E.
    Sam460ex 1 GHz + OS 4.1 F.E.
    MacMini 1.5 GHz + MorphOS 3.12
    PowerBook G4 1.65 + MorphOS 3.12
  • »12.11.19 - 10:07
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Templario
    Posts: 304 from 2012/4/28
    The problem continues the user-network-startup file not make nothing.
    Amiga 500 with ROMs 1.3-2.05 and M-Tec AT 500 with hard disk and 4MB Ram.
    WinUAE + original OS 3.5&3.9
    Sam440ep 800 MHZ + OS 4.1 F.E.
    Sam460ex 1 GHz + OS 4.1 F.E.
    MacMini 1.5 GHz + MorphOS 3.12
    PowerBook G4 1.65 + MorphOS 3.12
  • »14.11.19 - 08:32
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 1885 from 2003/3/5
    From: Poland
    Well, does 'setclockntp' help when run from shell? Did you set a timezone in Time settings?

    [ Edited by jacadcaps 14.11.2019 - 13:21 ]
  • »14.11.19 - 12:21
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Templario
    Posts: 304 from 2012/4/28
    Quote:

    jPV escribió:
    @Templario

    Is your machine connected to Internet? :) SetClockNTP tries to sync the clock from the Internet...

    SetClock can be used to manually set the clock.

    https://library.morph.zone/Shell_Commands/SetClock
    https://library.morph.zone/Shell_Commands/SetClockNTP


    Thank you for your help, I was finding a shell command to set the time date and hour because these commands are to use the clock with battery, and my mac hasn't it.
    My idea is make a little tool or ARexx command to save to a txt file with the date and hour and read it to set when I not use Internet.
    Amiga 500 with ROMs 1.3-2.05 and M-Tec AT 500 with hard disk and 4MB Ram.
    WinUAE + original OS 3.5&3.9
    Sam440ep 800 MHZ + OS 4.1 F.E.
    Sam460ex 1 GHz + OS 4.1 F.E.
    MacMini 1.5 GHz + MorphOS 3.12
    PowerBook G4 1.65 + MorphOS 3.12
  • »18.11.19 - 11:13
    Profile Visit Website
  • jPV
  • Paladin of the Pegasos
    Paladin of the Pegasos
    jPV
    Posts: 1593 from 2003/2/24
    From: po-RNO
    Quote:

    Templario wrote:
    Thank you for your help, I was finding a shell command to set the time date and hour because these commands are to use the clock with battery, and my mac hasn't it.
    My idea is make a little tool or ARexx command to save to a txt file with the date and hour and read it to set when I not use Internet.

    Oops, sorry. Those my previous suggestions aren't good for that indeed.

    But the Date command would be better, and some shell scripts would probably be enough, no need to go to heavier scripting/programming

    For example, to save the date to a file:
    Date > ENVARC:mytimehack

    and then to set the date from the file:
    Date >NIL: ? < ENVARC:mytimehack

    ...or something like that.

    You could, for example, to make a shell script that you use to shutdown/reboot the machine always:
    Code:
    Date > ENVARC:mytimehack
    RequestChoice >ENV:rcnum "SHUTDOWN" "Press enter to shutdown or wait 10s to cancel." "Shutdown" "Reboot" "Cancel" TYPE=1 TIMEOUT=10
    Wait 2
    If 1 EQ $rcnum
    Shutdown
    Quit
    EndIf
    If 2 EQ $rcnum
    Reboot
    Quit
    EndIf


    And then have that "Date >NIL: ? < ENVARC:mytimehack" in s:user-startup...

    But of course the clock will be wrong when your machine is off for a longer time and lose time in reboots, how did you think to handle that?
  • »18.11.19 - 13:39
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Templario
    Posts: 304 from 2012/4/28
    Thank you for your help, only the Date >NIL:? <ENVARC:MyHour not works, isn't open redirection file.
    The reboot well, it will be a single command with a shell icon to adjust it, this is the idea.
    Amiga 500 with ROMs 1.3-2.05 and M-Tec AT 500 with hard disk and 4MB Ram.
    WinUAE + original OS 3.5&3.9
    Sam440ep 800 MHZ + OS 4.1 F.E.
    Sam460ex 1 GHz + OS 4.1 F.E.
    MacMini 1.5 GHz + MorphOS 3.12
    PowerBook G4 1.65 + MorphOS 3.12
  • »18.11.19 - 15:42
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    polluks
    Posts: 453 from 2007/10/23
    From: Gelsenkirchen,...
    How about this?
    Code:
    Date $MyHour
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.12
  • »18.11.19 - 23:32
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Templario
    Posts: 304 from 2012/4/28
    Thank you for your help, already I make me a little Hollywood tool for this problem.
    Amiga 500 with ROMs 1.3-2.05 and M-Tec AT 500 with hard disk and 4MB Ram.
    WinUAE + original OS 3.5&3.9
    Sam440ep 800 MHZ + OS 4.1 F.E.
    Sam460ex 1 GHz + OS 4.1 F.E.
    MacMini 1.5 GHz + MorphOS 3.12
    PowerBook G4 1.65 + MorphOS 3.12
  • »20.11.19 - 08:31
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Templario
    Posts: 304 from 2012/4/28
    Hi again other question are there any shell command to call to MorphOS Preferences to change the date and hour like under AmigaOS3.x the Time preferences tool?

    [ Editado por Templario 22.11.2019 - 12:29 ]
    Amiga 500 with ROMs 1.3-2.05 and M-Tec AT 500 with hard disk and 4MB Ram.
    WinUAE + original OS 3.5&3.9
    Sam440ep 800 MHZ + OS 4.1 F.E.
    Sam460ex 1 GHz + OS 4.1 F.E.
    MacMini 1.5 GHz + MorphOS 3.12
    PowerBook G4 1.65 + MorphOS 3.12
  • »22.11.19 - 09:40
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Templario
    Posts: 304 from 2012/4/28
    Quote:

    jPV escribió:
    SYS:MorphOS/Prefs/Preferences Time



    Thank very much for your big help, I could tested that with this instruction you can call to other Preferences options, and I added to my little program to clock battery problem. Again thank you very much.
    Amiga 500 with ROMs 1.3-2.05 and M-Tec AT 500 with hard disk and 4MB Ram.
    WinUAE + original OS 3.5&3.9
    Sam440ep 800 MHZ + OS 4.1 F.E.
    Sam460ex 1 GHz + OS 4.1 F.E.
    MacMini 1.5 GHz + MorphOS 3.12
    PowerBook G4 1.65 + MorphOS 3.12
  • »23.11.19 - 08:05
    Profile Visit Website