Imprisonment as condition of probation or suspension of sentence--Credit for time

— under SENTENCE AND JUDGMENT.

The conditions of probation imposed pursuant to § 23A-27-12 or 23A-27-13 or the conditions of suspension of execution imposed pursuant to § 23A-27-18 , may include the requirement that the defendant be imprisoned in the county jail for no more than one hundred eighty days, except as otherwise specified in this section, or in a state correctional facility for no more than one hundred eighty days or the sentence which was imposed or which may be imposed by law, whichever is less. However, for persons sentenced pursuant to § 32-23-4.6 , the conditions of probation imposed pursuant to § 23A-27-12 or 23A-27-13 or the conditions of suspension of execution imposed pursuant to § 23A-27-18 , may include the requirement that the defendant be imprisoned in the county jail for a specific period not exceeding three hundred sixty-five days. The imprisonment may be further restricted to certain days specified by the court as part of such conditions. The required period of imprisonment for a county jail or state incarceration term should not exceed sixty consecutive days to ensure the court retains authority to impose additional days of imprisonment, if necessary, during the term of supervision pursuant to §