Galaxy evolution in groups and clusters: satellite star formation histories and quenching time-scales in a hierarchical Universe