You cannot prevent that users will be able to run
pam_time.so, as this only ensures that the PAM permission check will fail when a user actually tries to change his or her password.
If your goal is to prevent users from changing their password using
chpasswd during the specified hours in
/etc/security/time.conf this approach should suffice.
If you want to prevent users from running
chpasswd you would need to add something like this cronjob (e.g.
/etc/cron.d/disable_chpasswd) that disables the permissions for other users to run this program at the specified hour.
# disable chpasswd daily at 5pm
0 17 * * * root /usr/bin/chmod 4750 /usr/bin/chpasswd
# enable chpasswd daily at 5am
0 5 * * * root /usr/bin/chmod 4755 /usr/bin/chpasswd
However, if you want to prevent users from changing their password altogether you can't rely on
pam_time.so (or such a cronjob) because users would still be able to change their password using
passwd (which as far as I know does not use the account management group) or possibly other methods (e.g. some graphical tools use the D-Bus interface provided by AccountsService). To circumvent that you could for example set up a cron job that disables and enables password changing in your PAM configuration (but I don't know if this would be a viable solution for you).