1# $NetBSD: varmod-gmtime.mk,v 1.2 2020/08/16 12:48:55 rillig Exp $ 2# 3# Tests for the :gmtime variable modifier, which formats a timestamp 4# using strftime(3). 5 6all: mod-gmtime 7all: mod-gmtime-indirect 8 9mod-gmtime: 10 @echo $@: 11 @echo ${%Y:L:gmtim=1593536400} # modifier name too short 12 @echo ${%Y:L:gmtime=1593536400} # 2020-07-01T00:00:00Z 13 @echo ${%Y:L:gmtimer=1593536400} # modifier name too long 14 @echo ${%Y:L:gm=gm:M*} 15 16mod-gmtime-indirect: 17 @echo $@: 18 19 # As of 2020-08-16, it is not possible to pass the seconds via a 20 # variable expression. This is because parsing of the :gmtime 21 # modifier stops at the '$' and returns to ApplyModifiers. 22 # 23 # There, a colon would be skipped but not a dollar. 24 # Parsing therefore continues at the '$' of the ${:U159...}, looking 25 # for an ordinary variable modifier. 26 # 27 # At this point, the ${:U} is expanded and interpreted as a variable 28 # modifier, which results in the error message "Unknown modifier '1'". 29 # 30 # If ApplyModifier_Gmtime were to pass its argument through 31 # ParseModifierPart, this would work. 32 @echo ${%Y:L:gmtime=${:U1593536400}} 33 34all: 35 @:; 36