You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "michallenc (via GitHub)" <gi...@apache.org> on 2023/04/29 10:11:36 UTC
[GitHub] [nuttx-apps] michallenc opened a new pull request, #1732: examples: add adjtime example application
michallenc opened a new pull request, #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732
## Summary
This application demonstrates the usage of adjtime() interface.
## Impact
None, just new example application.
## Testing
Tested on samv7 based board.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] michallenc commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1188189448
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
+{
+ FAR char *string;
+ int ret;
+
+ ret = arg_string(arg, &string);
+ *value = strtol(string, NULL, 10);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct timeval *delta, int argc,
+ FAR char **argv)
+{
+ FAR char *ptr;
+ long value;
+ int index;
+ int nargs;
+
+ for (index = 1; index < argc; )
+ {
+ ptr = argv[index];
+ if (ptr[0] != '-')
+ {
+ printf("Invalid options format: %s\n", ptr);
+ exit(0);
+ }
+
+ switch (ptr[1])
+ {
+ case 's':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_sec = (uint32_t)value;
+ index += nargs;
+ break;
+
+ case 'u':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_usec = (uint32_t)value;
Review Comment:
I dont think usec should be unsigned. The timeval structure is defined as
```C
struct timeval
{
time_t tv_sec; /* Seconds */
long tv_usec; /* Microseconds */
};
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] simbit18 commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1182801856
##########
examples/adjtime/Makefile:
##########
@@ -0,0 +1,42 @@
+############################################################################
+# apps/examples/adjtime/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(APPDIR)/Make.defs
+
+# Hello, World! built-in application info
+
+PROGNAME = $(CONFIG_EXAMPLES_ADJTIME_PROGNAME)
+PRIORITY = $(CONFIG_EXAMPLES_ADJTIME_PRIORITY)
+STACKSIZE = $(CONFIG_EXAMPLES_ADJTIME_STACKSIZE)
+MODULE = $(CONFIG_EXAMPLES_ADJTIME)
+
+# Hello, World! Example
Review Comment:
# Hello, World! -> # Adjtime
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1181173874
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * hello_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+ struct timeval delta;
+ struct timeval olddelta;
+ int sc;
Review Comment:
why `sc` and not `ret` as it is more widely used?
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * hello_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+ struct timeval delta;
+ struct timeval olddelta;
Review Comment:
```suggestion
struct timeval delta;
struct timeval olddelta;
```
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * hello_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+ struct timeval delta;
+ struct timeval olddelta;
+ int sc;
+
+ /* Set delta between real time and system tick. */
+
+ delta.tv_sec = 0;
+ delta.tv_usec = 1000000;
+
+ printf("Delta time is %ld seconds and %ld micro seconds.\n",
+ delta.tv_sec, delta.tv_usec);
Review Comment:
```suggestion
printf("Delta time is %ld seconds and %ld micro seconds.\n",
delta.tv_sec, delta.tv_usec);
```
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * hello_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+ struct timeval delta;
+ struct timeval olddelta;
+ int sc;
+
+ /* Set delta between real time and system tick. */
+
+ delta.tv_sec = 0;
+ delta.tv_usec = 1000000;
+
+ printf("Delta time is %ld seconds and %ld micro seconds.\n",
+ delta.tv_sec, delta.tv_usec);
+
+ /* Call adjtime function. */
+
+ sc = adjtime(&delta, &olddelta);
+ if (sc < 0)
+ {
+ printf("ERROR: adjtime() failed: %d\n", sc);
+ }
+ else
+ {
+ printf("Returned olddelta is %ld seconds and %ld micro seconds.\n",
+ olddelta.tv_sec, olddelta.tv_usec);
Review Comment:
```suggestion
printf("Returned olddelta is %ld seconds and %ld micro seconds.\n",
olddelta.tv_sec, olddelta.tv_usec);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] michallenc commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1188189448
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
+{
+ FAR char *string;
+ int ret;
+
+ ret = arg_string(arg, &string);
+ *value = strtol(string, NULL, 10);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct timeval *delta, int argc,
+ FAR char **argv)
+{
+ FAR char *ptr;
+ long value;
+ int index;
+ int nargs;
+
+ for (index = 1; index < argc; )
+ {
+ ptr = argv[index];
+ if (ptr[0] != '-')
+ {
+ printf("Invalid options format: %s\n", ptr);
+ exit(0);
+ }
+
+ switch (ptr[1])
+ {
+ case 's':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_sec = (uint32_t)value;
+ index += nargs;
+ break;
+
+ case 'u':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_usec = (uint32_t)value;
Review Comment:
Yes, timeval structure is defined as
```C
struct timeval
{
time_t tv_sec; /* Seconds */
long tv_usec; /* Microseconds */
};
```
per https://github.com/apache/nuttx/blob/master/include/sys/time.h#L131
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1187267900
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
+{
+ FAR char *string;
+ int ret;
+
+ ret = arg_string(arg, &string);
+ *value = strtol(string, NULL, 10);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(struct timeval *delta, int argc,
+ char **argv)
Review Comment:
```suggestion
static void parse_args(FAR struct timeval *delta, int argc,
FAR char **argv)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1187683533
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
+{
+ FAR char *string;
+ int ret;
+
+ ret = arg_string(arg, &string);
+ *value = strtol(string, NULL, 10);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct timeval *delta, int argc,
+ FAR char **argv)
+{
+ FAR char *ptr;
+ long value;
Review Comment:
```suggestion
unsigned long value;
```
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
+{
+ FAR char *string;
+ int ret;
+
+ ret = arg_string(arg, &string);
+ *value = strtol(string, NULL, 10);
Review Comment:
```suggestion
*value = strtoul(string, NULL, 10);
```
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
+{
+ FAR char *string;
+ int ret;
+
+ ret = arg_string(arg, &string);
+ *value = strtol(string, NULL, 10);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct timeval *delta, int argc,
+ FAR char **argv)
+{
+ FAR char *ptr;
+ long value;
+ int index;
+ int nargs;
+
+ for (index = 1; index < argc; )
+ {
+ ptr = argv[index];
+ if (ptr[0] != '-')
+ {
+ printf("Invalid options format: %s\n", ptr);
+ exit(0);
+ }
+
+ switch (ptr[1])
+ {
+ case 's':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_sec = (uint32_t)value;
Review Comment:
remove the cast, tv_sec may unsigned long long
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
Review Comment:
```suggestion
static int arg_decimal(FAR char **arg, FAR unsigned long *value)
```
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
+{
+ FAR char *string;
+ int ret;
+
+ ret = arg_string(arg, &string);
+ *value = strtol(string, NULL, 10);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct timeval *delta, int argc,
+ FAR char **argv)
+{
+ FAR char *ptr;
+ long value;
+ int index;
+ int nargs;
+
+ for (index = 1; index < argc; )
+ {
+ ptr = argv[index];
+ if (ptr[0] != '-')
+ {
+ printf("Invalid options format: %s\n", ptr);
+ exit(0);
+ }
+
+ switch (ptr[1])
+ {
+ case 's':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_sec = (uint32_t)value;
+ index += nargs;
+ break;
+
+ case 'u':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_usec = (uint32_t)value;
Review Comment:
remove the cast too
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] michallenc commented on pull request #1732: examples: add adjtime example application
Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#issuecomment-1532197010
Thank you all for the suggestions, I will go throught this by the end of the week.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] michallenc commented on pull request #1732: examples: add adjtime example application
Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#issuecomment-1539548190
@xiaoxiang781216 fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] simbit18 commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1182805738
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * hello_main
Review Comment:
hello_main -> adjtime_main
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] simbit18 commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1182801856
##########
examples/adjtime/Makefile:
##########
@@ -0,0 +1,42 @@
+############################################################################
+# apps/examples/adjtime/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(APPDIR)/Make.defs
+
+# Hello, World! built-in application info
+
+PROGNAME = $(CONFIG_EXAMPLES_ADJTIME_PROGNAME)
+PRIORITY = $(CONFIG_EXAMPLES_ADJTIME_PRIORITY)
+STACKSIZE = $(CONFIG_EXAMPLES_ADJTIME_STACKSIZE)
+MODULE = $(CONFIG_EXAMPLES_ADJTIME)
+
+# Hello, World! Example
Review Comment:
Hello, World! -> Adjtime
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 merged pull request #1732: examples: add adjtime example application
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] michallenc commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1188189448
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pwm_help
+ ****************************************************************************/
+
+static void adjtime_help(void)
+{
+ printf("Usage: adjtime [OPTIONS]\n");
+ printf(" [-s delta->tv_sec] sets delta in seconds.\n");
+ printf(" [-u delta->tv_usec] sets delta in micro seconds.\n");
+ printf(" [-h] shows this message and exits\n");
+ printf("Both delta->tv_sec and delta->tv_usec are set to 0 by default\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+ FAR char *ptr = *arg;
+
+ if (ptr[2] == '\0')
+ {
+ *value = arg[1];
+ return 2;
+ }
+ else
+ {
+ *value = &ptr[2];
+ return 1;
+ }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR long *value)
+{
+ FAR char *string;
+ int ret;
+
+ ret = arg_string(arg, &string);
+ *value = strtol(string, NULL, 10);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct timeval *delta, int argc,
+ FAR char **argv)
+{
+ FAR char *ptr;
+ long value;
+ int index;
+ int nargs;
+
+ for (index = 1; index < argc; )
+ {
+ ptr = argv[index];
+ if (ptr[0] != '-')
+ {
+ printf("Invalid options format: %s\n", ptr);
+ exit(0);
+ }
+
+ switch (ptr[1])
+ {
+ case 's':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_sec = (uint32_t)value;
+ index += nargs;
+ break;
+
+ case 'u':
+ nargs = arg_decimal(&argv[index], &value);
+
+ delta->tv_usec = (uint32_t)value;
Review Comment:
I dont think usec should be unsigned. The timeval structure is defined as
```C
struct timeval
{
time_t tv_sec; /* Seconds */
long tv_usec; /* Microseconds */
};
```
per https://github.com/apache/nuttx/blob/master/include/sys/time.h#L131
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] acassis commented on a diff in pull request #1732: examples: add adjtime example application
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#discussion_r1181074733
##########
examples/adjtime/Kconfig:
##########
@@ -0,0 +1,32 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config EXAMPLES_ADJTIME
+ tristate "Ajdtime fucntion example"
Review Comment:
```suggestion
tristate "Ajdtime function example"
##########
examples/adjtime/Makefile:
##########
@@ -0,0 +1,42 @@
+############################################################################
+# apps/examples/adjtime/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(APPDIR)/Make.defs
+
+# Hello, World! built-in application info
+
+PROGNAME = $(CONFIG_EXAMPLES_ADJTIME_PROGNAME)
+PRIORITY = $(CONFIG_EXAMPLES_ADJTIME_PRIORITY)
+STACKSIZE = $(CONFIG_EXAMPLES_ADJTIME_STACKSIZE)
+MODULE = $(CONFIG_EXAMPLES_ADJTIME)
+
+# Hello, World! Example
+
+MAINSRC = adjtime_main.c
+
+# Build with WebAssembly when CONFIG_INTERPRETERS_WAMR is enabled
+
+WASM_BUILD = y
+
+# Mode of WebAssembly Micro Runtime
+
+WAMR_MODE = AOT
+
Review Comment:
Is this required?
##########
examples/adjtime/adjtime_main.c:
##########
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * apps/examples/adjtime/adjtime_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * hello_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+ struct timeval delta;
+ struct timeval olddelta;
+ int sc;
+
+ /* Set delta between real time and system tick. */
+
+ delta.tv_sec = 0;
+ delta.tv_usec = 1000000;
Review Comment:
maybe you can use this tv_usec value by default, bug if the user passed a usec value as argument you can use it, this way the adjtime application can be used for real application as well. In the Linux systems there is a file /etc/adjtime_config that is used by hwclock to fix it automatically during the boot: https://man7.org/linux/man-pages/man5/adjtime_config.5.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] michallenc commented on pull request #1732: examples: add adjtime example application
Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on PR #1732:
URL: https://github.com/apache/nuttx-apps/pull/1732#issuecomment-1537958097
@acassis @pkarashchenko @simbit18 I updated the code based on your feedback. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org