
    655 A.2d 1000
    COMMONWEALTH of Pennsylvania v. Emerson MILLER, Appellant.
    Superior Court of Pennsylvania.
    Submitted Dec. 19, 1994.
    Filed Feb. 22, 1995.
    
      Emerson Miller, pro se.
    Annmarie Kaiser, Asst. Dist. Atty., Harrisburg, for Com., appellee.
    Before ROWLEY, P.J., and WIEAND and CERCONE, JJ.
   WIEAND, Judge.

Emerson Miller, the appellant, was arrested on March 26, 1993 and charged with delivery of a controlled substance. He posted bail on April 2, 1993 and was released from custody. On July 24, 1993, however, Miller was arrested on an unrelated charge of aggravated assault; and, on August 5, 1993, he was additionally charged with robbery, a charge which arose from the same incident which had produced the aggravated assault charge. He remained incarcerated on the aggravated assault and robbery charges until January 13, 1994, when he was tried and acquitted of those charges. Meanwhile, on November 24, 1993, Miller had entered a plea of guilty to the controlled substance charge; and sentencing had been deferred pending preparation of a presentence report. On February 14, 1994, Miller was sentenced for delivery of a controlled substance to serve a term of imprisonment for not less than thirty-three (33) months nor more than seven (7) years. No direct appeal was taken from the judgment of sentence.

On June 24, 1994, however, Miller filed a petition to obtain credit for all time during which he had been incarcerated before being sentenced. On July 12, 1994, the trial court entered an order denying Miller’s petition. A notice of appeal was filed by Miller on August 8, 1994. Thereafter, on August 17, 1994, the trial court entered an order amending Miller’s sentence and giving him credit for the time from March 26, 1993 to April 2, 1993, during which he had been in custody on the drug charge prior to posting bail. However, the court refused to give Miller credit for time served from July 24, 1993 to January 13, 1994, the period during which he was in custody following arrest for the unrelated charges of aggravated assault and robbery. On appeal, Miller continues to argue that he should receive credit for all time that he was in custody prior to being sentenced on the drug charge to which he pleaded guilty.

The Sentencing Code provides for the awarding of credit for time served in the following manner:

After reviewing the information submitted under section 9737 (relating to report of outstanding charges and sentences) the court shall give credit as follows:
(1) Credit against the maximum term and any minimum term shall be given to the defendant for all time spent in custody as a result of the criminal charge for which a prison sentence is imposed or as a result of the conduct on which such a charge is based. Credit shall include credit for time spent in custody prior to trial, during trial, pending sentence, and pending the resolution of an appeal.
(2) Credit against the maximum term and any minimum term shall be given to the defendant for all time spent in custody under a prior sentence if he is later reprosecuted and resentenced for the same offense or for another offense based on the same act or acts. This shall include credit in accordance with paragraph (1) of this section for all time spent in custody as a result of both the original charge and any subsequent charge for the same offense or for another offense based on the same act or acts.
(3) If the defendant is serving multiple sentences, and if one of the sentences is set aside as the result of direct or collateral attack, credit against the maximum and any minimum term of the remaining sentences shall be given for all time served in relation to the sentence set aside since the commission of the offenses on which the sentences were based.
(4) If the defendant is arrested on one charge and later prosecuted on another charge growing out of an act or acts that occurred prior to his arrest, credit against the maximum term and any minimum term of any sentence resulting from such prosecution shall be given for all time spent in custody under the former charge that has not been credited against another sentence.

42 Pa.C.S. § 9760. The statute is amplified by the Rules of Criminal Procedure, which provide:

(b) A sentence to imprisonment shall be deemed to commence and shall be computed from the date of commitment for the offense or offenses for which such sentence is imposed, which date shall be specified by the judge. Credit, to be calculated by the clerk of court, shall be given as provided by law for any days spent in custody by the defendant for such offense or offenses prior to the imposition of sentence.

Pa.R.Crim.P. 1406(b).

The decided cases have held generally that a defendant shall be given “credit for any days spent in custody prior to the imposition of sentence, but only if such commitment is on the offense for which sentence is imposed. Credit is not given, however, for a commitment by reason of a separate and distinct offense.” Commonwealth ex rel. Bleecher v. Rundle, 207 Pa.Super. 443, 445, 217 A.2d 772, 774 (1966). See: Commonwealth v. Schartner, 227 Pa.Super. 401, 323 A.2d 237 (1974); Commonwealth v. Presogna, 226 Pa.Super. 485, 313 A.2d 360 (1973); Commonwealth v. Ulmer, 211 Pa.Super. 193, 238 A.2d 38 (1967). See also: Commonwealth v. Hollawell, supra at 46-48, 604 A.2d at 725-726. Commonwealth v. Clark, 238 Pa.Super. 444, 450, 357 A.2d 648, 651 (1976) (plurality opinion).

As such, appellant was clearly entitled to receive credit for the eight days that he was in custody prior to posting bail on the drug charge. Appellant argues that, under 42 Pa.C.S. § 9760(4), he was also entitled to receive credit for the one hundred and seventy-four (174) days during which he was in custody for the unrelated aggravated assault and robbery charges. He asserts that under subsection (4) of the statute, credit must be given for all pre-sentence time spent in custody, even time served on unrelated charges, where credit has not otherwise been given therefor. Because he was acquitted of the unrelated aggravated assault and robbery charges, appellant contends, he did not receive credit against any other sentence for the time he was in custody on these charges; and, therefore, his argument concludes,' he must be given credit under § 9760(4) against his sentence for delivery of a controlled substance. We disagree.

Pursuant to 42 Pa.C.S. § 9760(4), credit is to be awarded if, on the date of the defendant’s arrest on charges for which he is being sentenced, he was already incarcerated for unrelated charges for which he was not given credit on any other sentence. In such circumstances, the defendant must be given credit for time served from the date of his arrest on the subject charges until the date of his sentencing for those charges, even though he was already incarcerated on unrelated charges on the date of his arrest. Principally, subsection (4) of the statute has been applied in situations where the defendant is in custody in another county or state on unrelated charges at the time he is arrested by the authorities in the sentencing county, and where he has not received credit against any other sentence for the time spent in custody in such other county or state. See: Commonwealth v. Little, 417 Pa.Super. 505, 612 A.2d 1053 (1992); Lantzy v. Commonwealth, 44 Pa.Commw. 396, 403 A.2d 1069 (1979). See also: Commonwealth v. Frank, 263 Pa.Super. 452, 476 n. 10, 398 A.2d 663, 675 n. 10 (1979).

In Commonwealth v. Little, supra, 417 Pa.Super. 505, 612 A.2d 1053, the defendant had been incarcerated in Allegheny County on unrelated charges at the time of his arrest in Centre County for theft and related charges. When defendant pleaded guilty to the theft charge and was sentenced in Centre County, he sought credit for time served while he was incarcerated in Allegheny County prior to his being sentenced in Centre County. The trial court refused to award credit for time served on grounds that the defendant’s incarceration in Allegheny County had been on wholly unrelated charges. On appeal, the Superior Court reversed. It concluded as follows:

[B]y reading § 9760(4) together with the provisions of § 9760(1), a defendant will be issued credit for the period of time confined in a different jurisdiction, which has not been credited, and which can be attributed to the pending criminal charges. By this' statement we hold that Appellant' must be given credit for the time spent in Allegheny County, following the date of his arrest on the Centre County charges, (January 23, 1991), until the date he was sentenced on the Centre County charges (April 8, 1991).

Commonwealth v. Little, supra at 509-510, 612 A.2d at 1055 (footnote omitted).

Under the facts of the instant case, however, 42 Pa.C.S. § 9760(4) is inapplicable. Here, appellant was not in custody for any other charges at the time he was arrested for delivery of a controlled substance. He had been arrested on the drug charge on March 26, 1993, and had posted bail on April 2, 1993. From the moment he posted bail on the drug charge and was released, appellant was no longer in custody on that charge. Therefore, when he was later arrested on unrelated charges and spent time in prison awaiting trial thereon, he was not entitled to credit on account of the drug charge. As to such charge he was free on bail and did not serve time. See: Commonwealth v. Schwartz, 251 Pa.Super. 36, 40, 379 A.2d 319, 321 (1977).

Therefore, the trial court did not err by refusing to award appellant credit for time served as a result of his being incarcerated during the period from July 24, 1993 until January 13, 1994. This period of custody resulted solely from appellant’s arrest for unrelated charges of aggravated assault and robbery and was in no way attributable to the drug charge for which appellant was subsequently sentenced.

The order of the trial court, as modified on August 17, 1994, is affirmed. 
      
      . A similar order denying a petition to receive credit for time served was deemed to be a final and appealable order in Commonwealth v. Hollawell, 413 Pa.Super. 42, 604 A.2d 723 (1992). There, the Superior Court observed that “where an appellant challenges the trial court’s failure to award credit for time served prior to sentencing, the claim involves the legality of sentence. A claim challenging the legality of sentence is appealable as of right.” Id. at 45, 604 A.2d at 725 (citation omitted). Cf. Commonwealth v. Perry, 386 Pa.Super. 534, 537-538, 563 A.2d 511, 512-513 (1989).
     
      
      . As a general rule, a trial court is without authority to modify a sentence after an appeal has been filed or thirty days has passed from the entry of the judgment of sentence. Commonwealth v. Bogden, 364 Pa.Super. 300, 304, 528 A.2d 168, 169-170 (1987); Commonwealth v. Lynch, 304 Pa.Super. 248, 251, 450 A.2d 664, 666 (1982). See: 42 Pa.C.S. § 5505. However, it is clear that "[t]he trial court unquestionably possesses the inherent power to correct an unlawful sentence at any time.” Commonwealth v. Hollawell, supra, 413 Pa.Super. 42, 604 A.2d 723. See also: Commonwealth v. Pastorkovic, 390 Pa.Super. 1, 7, 567 A.2d 1089, 1092 (1989); Commonwealth v. Ward, 340 Pa.Super. 1, 7-8, 489 A.2d 809, 812 (1985); Commonwealth v. Horsman, 239 Pa.Super. 534, 537-538, 361 A.2d 433, 434-435 (1976).
     
      
      . The charges in Allegheny County were subsequently nol prossed.
     
      
      . Whether the statute should be amended to require credit for time served under circumstances similar to those in the instant case is for the legislature to determine.
     