tree data FEATURE check nanosecond validity
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 1fd28df..b104304 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -900,7 +900,7 @@
 {
     char frac_buf[10];
 
-    LY_CHECK_ARG_RET(NULL, ts, str, LY_EINVAL);
+    LY_CHECK_ARG_RET(NULL, ts, str, ts->tv_nsec <= 999999999, LY_EINVAL);
 
     /* convert nanoseconds to fractions of a second */
     if (ts->tv_nsec) {