@@ -829,17 +829,17 @@ xlat_action_t xlat_eval_one_letter(TALLOC_CTX *ctx, fr_value_box_list_t *out,
829829
830830 case 'I' : /* Request ID */
831831 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT32 , NULL ));
832- value -> datum . uint32 = request -> packet -> id ;
832+ value -> vb_uint32 = request -> packet -> id ;
833833 break ;
834834
835835 case 'n' : /* Request number */
836836 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT64 , NULL ));
837- value -> datum . uint64 = request -> number ;
837+ value -> vb_uint64 = request -> number ;
838838 break ;
839839
840840 case 's' : /* First request in this sequence */
841841 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT64 , NULL ));
842- value -> datum . uint64 = request -> seq_start ;
842+ value -> vb_uint64 = request -> seq_start ;
843843 break ;
844844
845845 /*
@@ -848,19 +848,17 @@ xlat_action_t xlat_eval_one_letter(TALLOC_CTX *ctx, fr_value_box_list_t *out,
848848
849849 case 'c' : /* Current epoch time seconds */
850850 /*
851- * @todo - leave this as FR_TYPE_DATE, but add an enumv which changes the scale to
852- * seconds?
851+ * Note that this number MUST be an integer,
852+ * otherwise it will get printed as an actual
853+ * date!
853854 */
854855 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT64 , NULL ));
855- value -> datum . uint64 = (uint64_t )fr_time_to_sec (fr_time ());
856+ value -> vb_uint64 = (uint64_t )fr_time_to_sec (fr_time ());
856857 break ;
857858
858859 case 'C' : /* Current epoch time microsecond component */
859- /*
860- * @todo - we probably should remove this now that we have FR_TYPE_DATE with scaling.
861- */
862860 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT64 , NULL ));
863- value -> datum . uint64 = (uint64_t )fr_time_to_usec (fr_time ()) % 1000000 ;
861+ value -> vb_uint64 = (uint64_t )fr_time_to_usec (fr_time ()) % 1000000 ;
864862 break ;
865863
866864 /*
@@ -875,7 +873,7 @@ xlat_action_t xlat_eval_one_letter(TALLOC_CTX *ctx, fr_value_box_list_t *out,
875873 }
876874
877875 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT8 , NULL ));
878- value -> datum . uint8 = ts .tm_mday ;
876+ value -> vb_uint8 = ts .tm_mday ;
879877 break ;
880878
881879 case 'D' : /* Request date */
@@ -891,45 +889,43 @@ xlat_action_t xlat_eval_one_letter(TALLOC_CTX *ctx, fr_value_box_list_t *out,
891889 if (!localtime_r (& now , & ts )) goto error ;
892890
893891 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT8 , NULL ));
894- value -> datum . uint8 = ts .tm_sec ;
892+ value -> vb_uint8 = ts .tm_sec ;
895893 break ;
896894
897895 case 'G' : /* Request minute */
898896 if (!localtime_r (& now , & ts )) goto error ;
899897
900898 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT8 , NULL ));
901- value -> datum . uint8 = ts .tm_min ;
899+ value -> vb_uint8 = ts .tm_min ;
902900 break ;
903901
904902 case 'H' : /* Request hour */
905903 if (!localtime_r (& now , & ts )) goto error ;
906904
907905 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT8 , NULL ));
908- value -> datum . uint8 = ts .tm_hour ;
906+ value -> vb_uint8 = ts .tm_hour ;
909907 break ;
910908
911909 case 'l' : /* Request timestamp as seconds since the epoch */
912910 /*
913- * @todo - leave this as FR_TYPE_DATE, but add an enumv which changes the scale to
914- * seconds?
911+ * Note that this number MUST be an integer,
912+ * otherwise it will get printed as an actual
913+ * date!
915914 */
916915 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT64 , NULL ));
917- value -> datum . uint64 = (uint64_t ) now ;
916+ value -> vb_uint64 = (uint64_t ) now ;
918917 break ;
919918
920919 case 'm' : /* Request month */
921920 if (!localtime_r (& now , & ts )) goto error ;
922921
923922 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT8 , NULL ));
924- value -> datum . uint8 = ts .tm_mon + 1 ;
923+ value -> vb_uint8 = ts .tm_mon + 1 ;
925924 break ;
926925
927926 case 'M' : /* Request time microsecond component */
928- /*
929- * @todo - we probably should remove this now that we have FR_TYPE_DATE with scaling.
930- */
931927 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT64 , NULL ));
932- value -> datum . uint64 = (uint64_t )fr_time_to_usec (request -> packet -> timestamp ) % 1000000 ;
928+ value -> vb_uint64 = (uint64_t )fr_time_to_usec (request -> packet -> timestamp ) % 1000000 ;
933929 break ;
934930
935931 case 'S' : /* Request timestamp in SQL format */
@@ -979,7 +975,7 @@ xlat_action_t xlat_eval_one_letter(TALLOC_CTX *ctx, fr_value_box_list_t *out,
979975
980976 MEM (value = fr_value_box_alloc (ctx , FR_TYPE_UINT16 , NULL ));
981977
982- value -> datum . uint16 = ts .tm_year + 1900 ;
978+ value -> vb_uint16 = ts .tm_year + 1900 ;
983979 break ;
984980
985981 default :
0 commit comments