samples/posix/gettimeofday/README.html · samples/posix/gettimeofday/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · POSIX · Time

SNTP로 초기화하는 POSIX gettimeofday()

Network 시작 시 SNTP server에서 현재 시각을 받아 POSIX 시간 API가 사용할 system clock을 준비합니다.

Official pathsamples/posix/gettimeofday/README.html
Source filesamples/posix/gettimeofday/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

SNTP Kconfig, Internet·DNS 요구 사항과 Zephyr·host build 절차를 설명합니다.

Clock

gettimeofday()

Init

SNTP

Output

1 second interval

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 49DACA739D3EE0B929B22B3DB8A33AEE17AB9026153A4CD96184D5B5203D14A8
.. _posix-gettimeofday-sample:

POSIX gettimeofday() with clock initialization over SNTP
########################################################

Overview
********

This sample application demonstrates using the POSIX `gettimeofday()`_ function to display the
absolute wall clock time and local time every second. At system startup, the current time is
queried using the SNTP networking protocol, enabled by setting the
:kconfig:option:`CONFIG_NET_CONFIG_CLOCK_SNTP_INIT` and
:kconfig:option:`CONFIG_NET_CONFIG_SNTP_INIT_SERVER` options.

Requirements
************

- :ref:`networking_with_host`
- or, a board with hardware networking
- NAT/routing should be set up to allow connections to the Internet
- DNS server should be available on the host to resolve domain names

Building and Running
********************

This project outputs to the console. It can be built and executed on QEMU as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/posix/gettimeofday
   :host-os: unix
   :board: qemu_x86
   :goals: run
   :compact:

For comparison, to build directly for your host OS if it is POSIX compliant (for ex. Linux):

.. code-block:: console

   cd samples/posix/gettimeofday
   make -f Makefile.host

The make output file will be located in samples/posix/gettimeofday/build.

.. _gettimeofday(): https://pubs.opengroup.org/onlinepubs/009604599/functions/gettimeofday.html

Part 3

한국어 전문 번역

개요

이 sample application은 POSIX gettimeofday() 함수로 절대 wall-clock time과 local time을 1초마다 표시합니다. System이 시작될 때 CONFIG_NET_CONFIG_CLOCK_SNTP_INIT과 CONFIG_NET_CONFIG_SNTP_INIT_SERVER option으로 활성화한 SNTP networking protocol을 사용해 현재 시각을 질의합니다.

요구 사항

  • Host와 연결한 networking 환경 또는 hardware networking을 갖춘 board
  • Internet 연결을 허용하도록 설정한 NAT와 routing
  • Domain name을 해석할 수 있도록 host에서 이용 가능한 DNS server

빌드 및 실행

이 project는 console에 결과를 출력합니다. QEMU에서 다음과 같이 build하고 실행할 수 있습니다.

west build -b qemu_x86 samples/posix/gettimeofday
west build -t run

비교를 위해 host OS가 Linux 같은 POSIX 호환 system이면 host에서 직접 build할 수도 있습니다.

cd samples/posix/gettimeofday
make -f Makefile.host

Make로 만든 output file은 samples/posix/gettimeofday/build에 저장됩니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.