[¶ 1.] Sоrenson appeals from a judgment of conviction of simple assault, third offense, claiming that the trial court abused its discretion when it denied his motion to suppress based on violation of a discovery order and that it erred as a matter of law when it refused him credit on his sentence for time he spеnt at the Human Services Center undergoing psychiatric evaluation. We affirm.
FACTS AND PROCEDURE
[IT 2.] Sorenson assaulted Steve Gibson in Sorenson’s apartment after the two men had been drinking together. Sorenson was charged with simple assault, third offense. Prior to trial, his attorney filed a motion for discovery of the identity of witnesses to the crime and of all relevant facts, including the identity of witnesses who provided exculpatory information to the State. The motion was granted.
[¶3.] During noon recess of the trial, Sorensen’s attorney observed Robb Charles, a taxi cab driver, outside the courtroom. Charles was later called as a rebuttal witness by the State and testified to giving Sorensen a ride in his taxi on the day of the assault. Sorensen objected on the grounds that Charles’ identity as a witness had not been made known prior to trial during discovery. The prosecutor informed the court that his identity and testimony only became known to the State around 11:00 a.m. the morning of trial, approximately three hours before he was called to testify on rebuttal. 1 The objection was overruled and Sorenson was subsequently found guilty.
[¶ 4.] At the sentencing hearing, it was established that Sorenson had been incarcerated 203 days, with 25 of those days spent undergoing psychiatric evaluаtion at the Human Services Center (HSC). The trial court sentenced him to two years in the state penitentiary and gave him credit *148 for 178 days served, denying his request for credit for the days spent at HSC. Sorenson appeals.
ANALYSIS AND DECISION
[¶ 5.] 1. Whether the trial court abused its discretion in denying Sorenson’s motion to suppress Charles’ testimony based on State’s violation of the discovery order.
[¶ 6.] SDCL 23A-13-17 sets forth the remedies for breach of a discovery obligation. It provides in pertinent part:
If, at any time during the course of a proceeding, it is brought to the attention of a court that a party has failed to comply -with an applicаble discovery provision, the court may order such party to permit the discovery or inspection, grant a continuance, or prohibit the party from introducing evidence not disclosed, or it may enter such other order as it deems just under the circumstances.
“Although a trial court’s order for the production of evidence must be expeditiously carried out and obeyed, not every failure to produce evidence as ordered is prejudicial error.”
State v. Oster,
[¶ 7.] Sorenson is presumed to have been aware of this evidence and potential witness prior to trial. After assaulting Gibson, and fearing for Gibson’s life, Sor-enson walked from his apartment to a local convenience store where he called an ambulance for Gibson and a taxi for himself. Sorenson asked Charles to drive through the alley near his apartment with the taxi’s lights off, wait while Sorenson crawled in his apartment window to retrieve a few items, and then drive him and another person to a local bar. En route, Charles overheard Sorenson tell his companion that he “had knocked the shit out of’ another person in his apartment.
[¶ 8.] While authorities later looked for Sorenson in the bar, Sorenson called Charles to come back and give him and his friend a ride from the bar. Charles arrived but Sorenson and his friend did not come out. While Charles was inside the bar looking for him, Sorenson slid into the backseat of Charles’ taxi. Police found him lying on the backseat and he admitted he was hiding from them. He asked police if the victim in his apartment was dead. When told he was badly beaten, Sorenson replied, “Darn right. I am а fourth generation special forces” and referred to himself as a “killing machine.” At trial he explained he said these things in a joking manner to keep the “mood light” and did not expect to be arrested for assault.
[¶ 9.] Discovery statutes exist to eliminate trial by ambush.
Oster,
[¶ 10.] We will not reverse a ruling reviewed under an abuse of discretion standard absent a showing of prejudice.
State v. Daniel,
*149 [¶ 11.] 2. Whether the trial court’s refusal to credit Sorenson’s sentence with 25 days spent at the Human Services Center was a mistake of law.
[¶ 12.] Sorenson originally pled not guilty. Less than a month later, he filed a successful motion for a psychiatric evaluation. Thе trial court ordered that he be evaluated, at public expense, at the Human Services Center to determine his mental competency at the time of the alleged assault and his ability to assist in his defense at trial. Transportation to and from the facility was provided by the sheriffs office at publiс expense. Sorenson spent 25 days at HSC undergoing this evaluation. He was successful in changing his plea from not guilty to not guilty by reason of insanity. His motion for bifurcating the guilt/innocence phase and the sanity phase of his trial was granted.
[¶ 13.] Sorenson was found guilty by a jury of simple assault, third offense. His sanity trial was held beforе Judge Kern who determined that the evidence failed to support either a verdict of not guilty or not guilty by reason of insanity. The maximum sentence that could have been imposed was two years and a $2,000 fine. SDCL 22-18-1, 22-6-1(8). The trial court sentenced Sorenson to two years imprisonment and ordered him to pay court costs, attorney’s fees, and restitution. Sorenson was credited for time spent in county jail, but the court refused to award credit for the 25 days he was undergoing psychiatric evaluation at HSC. Sorenson claims the trial court erred in not crediting him for this time.
[¶ 14.] Unless there is some constitutional or statutory limitation, sentencing power is discretionary with the trial judge.
State v. Anderson,
[¶ 15.] However, where incarceration results from a defendant’s financial inability and failure to post bond, the traditional rule denying credit for presen-tence confinement does not apply. “‘The Fourteenth Amendment еqual protection clause requires that credit be given for all presentence custody which results from indigency.’”
State v. Green,
[¶ 16.] Several jurisdictions have addressed the issue of credit for presentence custody in locations other than jail. By statute, Iowa grants credit for time spent undergoing psychiatric evaluation during presentence custody where the defendant fails to furnish bail or is charged with a nonbailable offense.
State v. Capper,
[¶ 17.] As previously noted, South Dakota has no statute regarding credit for time spent рrior to sentencing, whether that time is spent in jail or another location. However, it follows from application of the rule set forth in Green, based on equal protection rights under the Fourteenth Amendment, that a defendant must be credited for time spent in a hospital for psychiatric evaluation while awaiting trial or sentencing if he remained in state custody during that time and his confinement was attributable to his indigency status. But for the hospitalization, such a defendant would still be incarcerated due to his financial inability to post bail. SDCL 23A-46-1, relating to the mental examination of criminal defendants, provides in pertinent рart that “the court may commit the person to be examined for a reasonable period to the custody of a suitable facility.” (emphasis added). Form 13 in the Appendix of Forms following SDCL ch. 23A-46 indicates the defendant remains under state custody at all times pertinent to the evaluation, including transport time tо and from the facility.
[¶ 18.] A defendant who is not indigent does not fall under the rule set forth in Green and need not be credited for time spent undergoing psychiatric evaluation, whether incarcerated or released on bail during that time. This is in keeping with the traditional rule that, absent a contrary statutory rule, a defendant dоes not have a right to credit for time spent in custody prior to trial or sentencing. In South Dakota, there is no contrary statutory rule and the sentencing court enjoys broad discretion in fashioning an appropriate sentence.
[¶ 19.] A defendant’s indigency status at the time of transfer for a court-ordered mental evaluation is a question of fact to be determined by the trial court. This record shows that on January 15, 1999, Sorenson’s application for appointment of counsel due to indigency was approved and counsel duly appointed. Bond was set at $20,000. On February 4, 1999, Sorenson was able to post $2,000 for his release on bail prior to trial. In
Green,
this Court noted the inability to post bail was an indication of indigency.
[¶ 20.] On February 19, Sorenson filed a motion for a psychiatric evaluation at HSC. One week later, the court granted his motion. The evaluation occurred after Sorenson had been returned to jail and his bond revoked for failure to timely appear at the motion hearing. On June 17, Soren-son filed a motion for reduction of his bond amount to $250. There is no record the court took any action on this motion.
[¶ 21.] Notwithstanding the question of Sorenson’s indigency status and the issue of equal protection, there is another factor affecting his claim that the court erred in failing to award credit for his time spent at HSC — whether Sorenson was eligible for release following revocation of his bond. SDCL 23A-43-21 provides:
*151 Upon a showing that there has been a material breach of a condition of release without good cause, the court shall declare a forfeiture of the bond, if any,, and shall enter an order revoking the conditions of release. If the defendant is not in custody, the court shall direct the clerk to issue a warrant for the defendant’s arrest. The defendant shall remain in custody until discharged by due course of law.
(emphasis added).
[¶ 22.] In
Smith v. State,
[¶ 23.] Similar facts exist here. Soren-son was released on bail but returned to jail one week later when he failed to appear on time at a motion hearing. His bond was revoked at that time. Pursuant to SDCL 23A-43-21, he was not eligible for release after February 12, whether or not he had the financial ability to post bail. This moots the question of credit for time spent at HSC after this date as his confinement was not attributable to his financial ability to post bond. The sentencing court, in its discretion, awarded Sorenson credit for all of the time he was in presen-tence custody, excluding only the 25 days of evаluation at HSC.
[¶ 24.] As sentencing courts in this state enjoy broad discretion within statutory and constitutional limitations in fashioning appropriate sentences, Anderson, supra, Sorenson’s equal protection rights were not impinged when he was confined following revocation of his bond. We find no mistake of law and affirm.
Notes
. Although Charles testified he was interviewed by police the day of the assault, no written report of his statement was found to exist.
. The rule applies in all cases involving sentences less than life.
Green, supra ; State v. Hill, 255
Neb. 173,
. The record shows Sorenson called the clerk’s office fifteen minutes prior to commencement of the hearing to indicate he would be late. He arrived at the courthouse thirty-five minutes after his hearing began. His bond was immediately forfeited and he submitted himself to the custody of the sheriff. He was later successful in obtaining an order to set aside enforcement of the forfeiture and hаve the bond revoked instead.
. Other jurisdictions follow this same rule.
See State v. Williams,
