{"id":18368739,"url":"https://github.com/openbmc/phosphor-time-manager","last_synced_at":"2025-04-06T17:31:51.700Z","repository":{"id":53835796,"uuid":"66553301","full_name":"openbmc/phosphor-time-manager","owner":"openbmc","description":"Local time policy and emulated host RTC manager","archived":false,"fork":false,"pushed_at":"2025-03-04T16:42:14.000Z","size":1580,"stargazers_count":6,"open_issues_count":6,"forks_count":10,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-22T04:03:07.887Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openbmc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-25T11:47:32.000Z","updated_at":"2025-03-04T16:42:18.000Z","dependencies_parsed_at":"2023-11-30T14:25:56.954Z","dependency_job_id":"9a1ff089-9320-492c-8c79-2198525d5b42","html_url":"https://github.com/openbmc/phosphor-time-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-time-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-time-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-time-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-time-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openbmc","download_url":"https://codeload.github.com/openbmc/phosphor-time-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247522423,"owners_count":20952545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T23:27:11.980Z","updated_at":"2025-04-06T17:31:51.361Z","avatar_url":"https://github.com/openbmc.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\n`phosphor-time-manager` is the time manager service that implements D-Bus\ninterface `xyz/openbmc_project/Time/EpochTime.interface.yaml`. The user can get\nor set the BMC's time via this interface.\n\n## Configuration\n\nphosphor-time-manager is configured by setting `-D` flags that correspond to\noptions in `phosphor-time-manager/meson.options`. The option names become C++\npreprocessor symbols that control which code is compiled into the program.\n\n- Compile phosphor-time-manager with default options:\n\n  ```bash\n     meson setup builddir\n     ninja -C builddir\n  ```\n\n- Compile phosphor-time-manager with some configurable options:\n\n  ```bash\n     meson setup builddir -Dbuildtype=minsize  -Dtests=disabled\n     ninja -C builddir\n  ```\n\n- Generate test coverage report:\n\n  ```bash\n     meson setup builddir -Db_coverage=true -Dtests=enabled\n     ninja coverage -C builddir test\n  ```\n\n### General usage\n\nThe service `xyz.openbmc_project.Time.Manager` provides an object on D-Bus:\n\n- /xyz/openbmc_project/time/bmc\n\nwhere each object implements interface `xyz.openbmc_project.Time.EpochTime`.\n\nThe user can directly get or set the property `Elapsed` of the objects to get or\nset the time. For example on an authenticated session:\n\n- To get BMC's time:\n\n  ```bash\n  ### With busctl on BMC\n  busctl get-property xyz.openbmc_project.Time.Manager \\\n      /xyz/openbmc_project/time/bmc xyz.openbmc_project.Time.EpochTime Elapsed\n\n  ### With REST API on remote host\n  curl -b cjar -k https://${BMC_IP}/xyz/openbmc_project/time/bmc\n  ```\n\n- To set BMC's time:\n\n  ```bash\n  ### With busctl on BMC\n  busctl set-property xyz.openbmc_project.Time.Manager \\\n      /xyz/openbmc_project/time/bmc xyz.openbmc_project.Time.EpochTime \\\n      Elapsed t \u003cvalue-in-microseconds\u003e\n\n  ### With REST API on remote host\n  curl -b cjar -k -H \"Content-Type: application/json\" -X PUT \\\n      -d '{\"data\": 1487304700000000}' \\\n      https://${BMC_IP}/xyz/openbmc_project/time/bmc/attr/Elapsed\n  ```\n\n### Time settings\n\nGetting BMC time is always allowed, but setting the time may not be allowed\ndepending on the below two settings in the settings manager.\n\n- TimeSyncMethod\n  - NTP: The time is set via NTP server.\n  - MANUAL: The time is set manually.\n\nA summary of which cases the time can be set on BMC or HOST:\n\n| Mode   | Set BMC Time |\n| ------ | ------------ |\n| NTP    | Fail to set  |\n| MANUAL | OK           |\n\n- To set an NTP [server](https://tf.nist.gov/tf-cgi/servers.cgi):\n\n  ```bash\n  ### With busctl on BMC\n  busctl set-property  xyz.openbmc_project.Network \\\n     /xyz/openbmc_project/network/eth0 \\\n     xyz.openbmc_project.Network.EthernetInterface NTPServers \\\n     as 1 \"\u003cntp_server\u003e\"\n\n  ### With REST API on remote host\n  curl -c cjar -b cjar -k -H \"Content-Type: application/json\" -X  PUT  -d \\\n      '{\"data\": [\"\u003cntp_server\u003e\"] }' \\\n      https://${BMC_IP}/xyz/openbmc_project/network/eth0/attr/NTPServers\n  ```\n\n- To go into NTP mode\n\n  ```bash\n  ### With busctl on BMC\n  busctl set-property xyz.openbmc_project.Settings \\\n      /xyz/openbmc_project/time/sync_method xyz.openbmc_project.Time.Synchronization \\\n      TimeSyncMethod s \"xyz.openbmc_project.Time.Synchronization.Method.NTP\"\n\n  ### With REST API on remote host\n  curl -c cjar -b cjar -k -H \"Content-Type: application/json\" -X  PUT  -d \\\n      '{\"data\": \"xyz.openbmc_project.Time.Synchronization.Method.NTP\" }' \\\n      https://${BMC_IP}/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod\n  ```\n\n### Special note on changing NTP setting\n\nStarting from OpenBMC 2.6 (with systemd v239), systemd's timedated introduces a\nnew beahvior that it checks the NTP services' status during setting time,\ninstead of checking the NTP setting:\n\n- When NTP server is set to disabled, and the NTP service is stopping but not\n  stopped, setting time will get an error.\n\nIn OpenBMC 2.4 (with systemd v236), the above will always succeed.\n\nThis results in [openbmc/openbmc#3459][1], and the related test cases are\nupdated to cooperate with this behavior change.\n\n[1]: https://github.com/openbmc/openbmc/issues/3459\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenbmc%2Fphosphor-time-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenbmc%2Fphosphor-time-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenbmc%2Fphosphor-time-manager/lists"}