1. 程式人生 > >三目運算支援巢狀

三目運算支援巢狀

上原始碼:

case DCH_MS:		/* millisecond */
	len = from_char_parse_int_len(&out->ms, &s, 3, n);

	/*
	 *   0.25 too; 025 is 0.025 and not 0.25
	*/
	out->ms *= len == 1 ? 100 :len == 2 ? 10 : 1;

	SKIP_THth(s, n->suffix);
	break;

此程式碼是 將.MS的值轉化為 毫秒值.

當len = 1時,ms = ms * len* 100;

當len = 2時,ms = ms * len * 10

else    ms = ms * len * 1;