Any person imprisoned for the purposes stated in the preceding section may be discharged from confinement at any time by the court wherein he was sentenced, and in no event shall his confinement, for failure to pay a fine and costs, exceed the term of six months. Any person confined in prison who is required to perform labor under the provisions of article fifteen, chapter seventeen of this code, shall be allowed, as a credit upon the fine and costs for which he is liable, the sum of one dollar and fifty cents a day for each day he has so labored, and when the amount of such credits equals the amount of the fine and costs he shall be discharged from custody.
W. Va. Code § 62-4-10