@@ -588,13 +588,46 @@ void test_parser_time_system_timezone_midnight()
588588 flb_config_exit (config );
589589}
590590
591+ void test_parser_time_lookup_long_fraction ()
592+ {
593+ int ret ;
594+ double ns ;
595+ time_t epoch ;
596+ struct flb_tm tm ;
597+ struct flb_parser * parser ;
598+ struct flb_config * config ;
599+ const char * time_string = "10/03/2016 12:21:08.123456789123456789123456789123456789123456789123456789" ;
600+
601+ config = flb_config_init ();
602+ load_json_parsers (config );
603+
604+ parser = flb_parser_get ("generic_N" , config );
605+ TEST_CHECK (parser != NULL );
606+ if (parser == NULL ) {
607+ flb_parser_exit (config );
608+ flb_config_exit (config );
609+ return ;
610+ }
611+
612+ ret = flb_parser_time_lookup (time_string , strlen (time_string ), 0 , parser , & tm , & ns );
613+ TEST_CHECK (ret == 0 );
614+
615+ epoch = flb_parser_tm2time (& tm , FLB_FALSE );
616+ TEST_CHECK (epoch == 1475497268 );
617+ TEST_CHECK (ns == 0.123456789 );
618+
619+ flb_parser_exit (config );
620+ flb_config_exit (config );
621+ }
622+
591623
592624TEST_LIST = {
593625 { "tzone_offset" , test_parser_tzone_offset },
594626 { "time_lookup" , test_parser_time_lookup },
595627 { "json_time_lookup" , test_json_parser_time_lookup },
596628 { "regex_time_lookup" , test_regex_parser_time_lookup },
597629 { "time_system_timezone_midnight" , test_parser_time_system_timezone_midnight },
630+ { "time_lookup_long_fraction" , test_parser_time_lookup_long_fraction },
598631 { "mysql_unquoted" , test_mysql_unquoted },
599632 { 0 }
600633};
0 commit comments