R, 97 95 93 Bytes
Usando los métodos encontrados anteriormente en R
c("Zzz","Good morning","Good afternoon","Good evening")[as.POSIXlt(Sys.time(),"G")$h%%20/6+1]
Explicación:
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
Ejemplo
Observe cómo esta línea de código, sin agregar 1, tiene 10 elementos cortos
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"
Agregar 1 asegura que el resultado obtenido sea mayor 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"