R, 97 95 93 bytes
Usando os métodos encontrados acima em R
c("Zzz","Good morning","Good afternoon","Good evening")[as.POSIXlt(Sys.time(),"G")$h%%20/6+1]
Explicação:
c("Zzz","Good morning","Good afternoon","Good evening") # Creates a vector with the greetings
[ # Open bracket. The number in the bracket will extract the corresponding greeting from the vector below
as.POSIXlt( # as.POSIXlt converts the object to one of the two classes used to represent date/times
Sys.time(), # Retrieves the current time on the OS
"G") # Converts the time to the desired time zone. Does output a warning, but still converts properly to GMT
$h # Extracts the hour from the object created by as.POSIXlt
%%20/6 # Methodology as used by other golfers
+1] # Vectors in R start from 1, and not 0 like in other languages, so adding 1 to the value ensures values range from 1 to 4, not 0 to 3
Exemplo
Observe como essa linha de código, sem adicionar 1, é curta 10 elementos
c('Zzz','Good morning','Good afternoon','Good evening')[0:23%%20/6]
[1] "Zzz" "Zzz" "Zzz" "Zzz" "Zzz" "Zzz"
[7] "Good morning" "Good morning" "Good morning" "Good morning" "Good morning" "Good morning"
[13] "Good afternoon" "Good afternoon"
A adição de 1 garante que o resultado obtido seja maior que 0
c('Zzz','Good morning','Good afternoon','Good evening')[as.integer(0:23)%%20/6+1]
[1] "Zzz" "Zzz" "Zzz" "Zzz" "Zzz" "Zzz"
[7] "Good morning" "Good morning" "Good morning" "Good morning" "Good morning" "Good morning"
[13] "Good afternoon" "Good afternoon" "Good afternoon" "Good afternoon" "Good afternoon" "Good afternoon"
[19] "Good evening" "Good evening" "Zzz" "Zzz" "Zzz" "Zzz"