
3 Cal.2d 740 (1935)
UNION SUGAR COMPANY (a Corporation), Appellant,
v.
HOLLISTER ESTATE COMPANY (a Corporation), Respondent.
L. A. No. 14113. 
Supreme Court of California. In Bank.  
June 25, 1935.
 Preisker, Goble & Twitchell for Appellant.
 Heaney, Price & Postel and Margaret Dunn Kamper for Respondent.
 CURTIS, J.
 We are in accord with the following portion of the opinion of the District Court of Appeal in the above-entitled cause and adopt the same as a part of our opinion:
 "On October 1, 1924, appellant and respondent contemporaneously executed a farming contract and a beet sale contract, the latter being expressly made a part of the former, by the terms of which appellant agreed to farm certain lands of respondent in a good and husbandlike manner and in accordance with the standards and customs in the vicinity, and plant and raise thereon a crop of beets during the 1925 season, at the expense of respondent, and to buy all the beets so raised and delivered at a price to be fixed by averaging prices of sugar over a period of twelve months *744 beginning July 1, 1925, according to a certain table set forth therein. On June 25, 1929, appellant brought suit against respondent to recover the alleged balance of $12,071.83, with interest at 7 per cent from October 31, 1925, unpaid on the advances and expenses of farming the lands and raising the crop of beets, after crediting the agreed price of beets produced and delivered. On December 2, 1929, respondent filed its answer and counterclaim, joining issue on the allegation of balance unpaid and pleading damages for specified breaches of the farming contract in respect to good husbandry in the sum of $31,067.31, as 'a counterclaim and set-off against plaintiff's demand to the extent thereof', and also praying for judgment for said amount 'or so much thereof as it may be entitled to over and above plaintiff's claim'. Trial was had, and in the lower court, prior to submission, appellant's counsel orally urged as a defense against the counterclaim the bar of the statute of limitations under section 337, subdivision 1, of the Code of Civil Procedure. Findings and conclusions were filed and judgment entered thereon in favor of respondent for the sum of $16,162.19, the excess of damages found to be suffered by respondent over the balance of expenses found to be due and unpaid to appellant. In its findings the court expressly found that the counterclaim was not barred by any statute of limitations."
 "From the judgment this appeal is taken on the so-called alternative method, appellant setting up four main points relating to (1) the bar of the statute of limitations to the counterclaim, (2) the measure of damage adopted by the court, (3) the matter of interest on the unpaid balance found, and (4) errors in ruling on evidence."
 [1] "Appellant contends that the counterclaim was barred by the provisions of section 337, subdivision 1, of the Code of Civil Procedure. Respondent meets this contention with the claim that appellant waived the bar of the statute by failing to plead the same. Unquestionably there is a general rule, long established in this State, that the statute of limitations is a special defense, personal in its nature, which may be waived or asserted, and that the party relying on it must affirmatively set it up in his pleading either by demurrer or answer, or it will be deemed to have been waived. (Grattan v. Wiggins, 23 Cal. 16; California Safe etc. Co. v. Sierra etc. Co., 158 Cal. 690 [112 P. 274, *745 Ann. Cas. 1912A, 729]; Miller v. Parker, 128 Cal.App. 775 [18 PaCal.2d 89].) There is, however, another rule which has developed in respect to the plea of the bar to counterclaims because of the provision in section 462 of the Code of Civil Procedure, which may be stated as follows: Where the answer to a complaint sets up new matter constituting an affirmative cause of action or counterclaim, such new matter is deemed controverted under the provisions of section 462 of the Code of Civil Procedure, and the adverse party may, without formal plea, show that the attempted defense is barred by the statute of limitations, that statute being deemed pleaded by operation of law. (Curtiss v. Sprague, 49 Cal. 301; Grangers' Business Assn. v. Clark, 84 Cal. 201 [23 P. 1081]; Estate of Garcelon, 104 Cal. 570 [38 P. 414, 43 Am.St.Rep. 134, 32 L.R.A. 595]; Moore v. Copp, 119 Cal. 429 [51 P. 630]; Brooks v. Johnson, 122 Cal. 569 [55 P. 423]; Peck v. Noee, 154 Cal. 351 [97 P. 865]; Hermosa Beach etc. Co. v. Law Credit Co., 175 Cal. 493 [166 P. 22]; Pacific Improvement Co. v. Maxwell, 26 Cal.App. 265 [146 P. 900]; Jones v. Peck, 63 Cal.App. 397 [218 P. 1030].) [2] However, it has been held that unless the adverse party invokes the plea of the statute at the trial, and brings to the attention of the trial court his purpose to offer evidence in support of such plea, the court cannot assume that he desires to make any such defense, and he cannot invoke the plea for the first time on appeal. (Estate of Garcelon, supra; Bliss v. Smith, 119 Cal. 526 [51 P. 848].) Herein appellant invoked the plea at the trial and the trial court made a finding on the plea thus presented. We must therefore hold that the statute was sufficiently pleaded and that it was properly entertained by the trial court."
 [3] "The counterclaim was not barred at the date of commencement of the action on June 25, 1929. The farming contract was an executory contract, continuing over the beet season of 1925, and could not be completed or fully performed by appellant until the end of that season, the date of which is established by evidence as the month of October, 1925. In such a contract, where the parties did not mutually abandon or rescind it upon a breach or successive breaches, the injured party could wait until the time arrived for a complete performance by the other party and *746 then bring an action for damages for such breaches. (Ross v. Tabor, 53 Cal.App. 605 [200 P. 971].) Respondent was not bound to treat the contract as abandoned on the first breach of it, or on any particular breach, but had his election to still rely on it, and the statute of limitations could not begin to run until it had made its election. (Richter v. Union Land etc. Co., 129 Cal. 367 [62 P. 39]; Coulter v. Sausalito Bay Water Co., 122 Cal.App. 480 [10 PaCal.2d 780].)"
 [4] "The filing of the complaint on June 25, 1929, operated to suspend the running of the statute of limitations as to any counterclaim existing at that date in favor of respondent, and therefore the counterclaim pleaded and filed on December 2, 1929, by respondent, although more than four years after completion of the contract, was not barred. (Perkins v. West Coast Lumber Co., 120 Cal. 27 [52 P. 118]; McDougald v. Hulet, 132 Cal. 154 [64 P. 278]; Whittier v. Visscher, 189 Cal. 450 [209 P. 23]; Maryland Casualty Co. v. Shafer, 57 Cal.App. 573 [208 P. 197].) [5] Nor did the amendment of section 438 of the Code of Civil Procedure in 1927 affect or destroy this rule, as is claimed by appellant. This becomes manifest upon examination of the above decisions, which are predicated alike upon counterclaims on contracts and torts without distinction, and all are based on the general proposition that such counterclaims must be existing at the commencement of action. Nor did such amendment, as appellant contends, have the effect of reducing the former statutory counterclaim to the common-law idea of counterclaim, that is, one that may be employed to diminish or defeat plaintiff's claim by way of set-off only to the extent of such claim. Section 666 of the Code of Civil Procedure, which must be read with section 438 as amended, provides that any excess of the counterclaim established over plaintiff's demand must be awarded to defendant by judgment. In the case of Terry Trading Corporation v. Barsky, 210 Cal. 428 [292 P. 474], the court in passing upon the effect of this amendment to section 438 said 'It is likewise perfectly proper to seek affirmative relief by way of counterclaim, which may not only defeat plaintiff's recovery but result in an affirmative judgment for defendant on his counterclaim.' " *747
 Appellant contends that in fixing respondent's damages the court applied an improper measure of damages. This attack of appellant is confined entirely to that part of the judgment rendered upon the counterclaim of respondent. No question is raised by appellant as to the amount of the judgment in its favor rendered by the court upon its cause of action set out in the complaint, except that appellant contends that the court improperly denied it interest on its claim against respondent. The question of interest will be given consideration later. The court found that respondent was indebted to appellant in the sum of $11,414.15, which sum was set off against the amount found due respondent on its counterclaim. It further found that the amount due respondent as damages on its counterclaim was $27,756.44. From this amount it deducted said sum of $11,414.15, leaving a balance of $16,162.19, for which amount it gave judgment against appellant. The appellant contends that the court erroneously fixed respondent's damages for appellant's breach of its contract at the sum of $27,756.44. In support of this contention appellant claims that the court in fixing the amount of respondent's damages failed to deduct from the value of the crop that should have been produced, had appellant farmed said lands in accordance with the standards prevailing in the vicinity in which said lands are located, certain costs and expenses that would necessarily have been incurred, had the required crop been produced by appellant. To put this contention concretely, appellant claims that the court, in arriving at the amount of respondent's damages, fixed the amount of the crop not produced, but which should have been produced, at 3,692 tons of beets, and the price at $7.77 per ton, and by multiplying this tonnage by the price per ton arrived at the sum of $27,756.44, and that no deduction was made from this aggregate amount of $27,756.44 for the cost of topping and hauling said 3,692 tons of beets. In producing and harvesting the crop grown by appellant during said season the appellant paid on an average $1.15 per ton for topping, and $1 per ton for hauling the beets grown, making a total cost for these two items of $2.15 per ton. Multiplying 3,692 tons, the amount of the extra crop, by $2.15 gives the sum of $7,927.80, which sum appellant claims should have been deducted from the amount of $27,756.44 in arriving at the respondent's damages. *748
 The finding of the court involving the issue of damages is as follows:
 "By reason of the failure of plaintiff to perform said contract in accordance with the terms thereof as hereinbefore found, defendant has been damaged in the sum of Twenty-seven Thousand Seven Hundred Fifty-six and 44/100 Dollars ($27,756.44), and is entitled to judgment in the sum of Sixteen Thousand One Hundred Sixty-two and 19/100 Dollars ($16,162.19), said sum of Sixteen Thousand One Hundred Sixty-two and 19/100 Dollars, being the excess of the damages, to-wit: Twenty-seven Thousand Seven Hundred Fifty- six and 44/100 Dollars ($27,756.44) over and above the sum of Eleven Thousand Four Hundred Fourteen and 15/100 Dollars ($11,414.15), due and owing from defendant to plaintiff for and on account of the expenditures made by plaintiff under said contract as hereinabove found."
 There is nothing in the findings to indicate how or in what manner the court arrived at the sum of $27,756.44 as respondent's damages for appellant's breach of its contract. There is no finding as to the number of tons of beets grown during said season, nor as to the number of tons of beets which should have been grown during said season, had appellant farmed said property in accordance with the terms of said contract, that is in a good and workmanlike manner and in accordance with the standards and customs prevailing in the vicinity in which said lands were located. Neither is there anything in the findings indicating the price which appellants were to pay for beets produced or which should have been produced under the contract with respondent. There is evidence in the record which would have supported a finding that had appellant farmed said lands as agreed in its contract with respondent there would have been produced during said season approximately 3,692 tons of beets in excess of what were actually produced, and it was stipulated that the average price of the beets as fixed by said contract was $7.77 per ton. That the court based its findings as to the amount of respondent's damage upon this evidence seems apparent from the written opinion of the trial judge filed in said action shortly after the trial, which opinion is included in the record on appeal. This opinion is brief and we quote it in its entirety, as follows: *749
 "It is my opinion that plaintiff is entitled to credit for the expenditures claimed, leaving a balance unpaid thereunder in the sum of $11,414.15."
 "However, the evidence, even of the plaintiff's witnesses, or at least some of them, supports defendant's contention that the area involved was improvidently farmed and that the cultivation of the crop was far from being of a husband-like character."
 "The acreage, under proper husbandry, should have yielded 15 tons per acre and the net deficit in return was of a tonnage of 3,692 tons. Averaging the grade of beets by those actually recovered as and of a 20% 59% sugar, the price would be $7.77 per ton. Indeed, it is fair to assume that better farming would have produced a beet much higher in sugar per cent."
 "The amount that defendant should have received would accordingly be increased in the amount of $27,756.44. Deducting from this the balance due of $11,414.15 we have a balance of $16,162.19 due defendant on its counterclaim, for which judgment is ordered."
 "Let findings be prepared by defendant and submitted to plaintiff before presentation."
 "Dated May 31st, 1932."
 There can hardly be a question as to the manner pursued by the trial court in measuring respondent's damage when viewed in the light of this opinion of the trial judge.
 [6] Respondent strenuously contends that the opinion of the trial court is no part of the record on appeal, and that a reviewing court is without authority to consider it in any manner in its decision of the appeal. There are authorities which hold that written opinions of the trial court though incorporated in the bill of exceptions or transcript on appeal, are no part of the record on appeal and cannot be considered by a reviewing court in determining the question whether the findings are supported by the evidence. (Goldner v. Spencer, 163 Cal. 317, 320 [125 P. 347]; DeCou v. Howell, 190 Cal. 741, 751 [214 P. 444]; Scholle v. Finnell, 173 Cal. 372, 376 [159 P. 1179]; Messenkop v. Duffield, 128 Cal.App. 541, 543 [18 PaCal.2d 67].) The sense in which these decisions may be taken is well illustrated by the statements of facts of these cases. We will only refer to the facts in the case of Goldner v. Spencer, supra, *750 as explaining the real meaning of these decisions. In that case the finding of the trial court was that a certain note and mortgage were void because given and accepted without consideration and for the purpose of hindering and delaying the creditors of the grantor. The appellant attempted to impeach this finding by showing that the trial judge, in a written opinion filed in the action, stated that he was satisfied by the evidence that the grantee had actually loaned the grantor a substantial sum of money and that the note and mortgage were executed to secure the loan and that the parties to the transaction did not conspire to defraud the creditors of the grantor. This court held that the written opinion of the trial judge could not be considered for such purpose, as the facts as set forth in the written opinion were in direct conflict with the findings of fact. There is another line of decisions in no way inconsistent with the cases just cited which hold that the opinion of the trial judge may be considered for the purpose of discovering the process by which the trial judge arrived at his conclusions, or when the opinion furnishes the basis of the court's action in its decision of the case. (Estate of Felton, 176 Cal. 663, 667 [169 P. 392], and Coakley v. Ajuria, 209 Cal. 745, 749 [290 P. 33].) In Estate of Felton, the court uses this significant language, "Opinions of judges of trial courts are always welcome by this court because, as a rule, they aid the justices in discovering the processes by which the judgments have been reached." In Coakley v. Ajuria, supra, the court held as follows: "We think the learned trial judge took an erroneous view of the law applicable to the facts, as is made apparent from an oral opinion which he delivered directing the order of nonsuit. While the reasons of a trial court so given do not in a strict sense constitute a part of the record on appeal, yet where they furnish, as in this case, the basis of the court's action, and really constitute the only grounds upon which the judgment may be affirmed, it is proper to give them special consideration."
 [7] The written opinion of the trial judge in the instant case clearly shows the process by which judgment was reached, or the basis on which the court computed the damages of the respondent under its counterclaim. It shows that the court simply took the number of tons of beets *751 which the respondent lost by reason of appellant's improvident farming methods, and the price these beets would have brought had they been produced, and by multiplying this tonnage by the price arrived at the loss or damage sustained by respondent. By this process the court found the damages sustained by respondent to be the precise amount which in its findings of fact it found the respondent had been damaged by appellant's improper farming methods. The opinion of the trial court does not, therefore, impeach any of its findings of fact in the sense that any statement therein is in conflict with any fact found by the court. It simply explains the formal findings and shows the basis on which the court arrived at the amount of damages as fixed.
 [8] Having ascertained the manner pursued by the trial court in fixing respondent's damages, the next question presented for determination is whether it applied the correct rule in fixing said damages. Under the written contract between the parties hereto, the respondent was to pay the entire cost of producing and harvesting the crop of beets to be grown under said contract. This cost included, of course, the expense of topping said beets and the hauling of them from the field to the factory of appellant. There is practically no dispute as to the reasonable cost of topping and hauling of the beets produced under said contract. Had the full amount of beets which said lands were capable of producing by proper farming methods been raised during said season, the respondent would have been obligated under its contract to pay the expense of topping and hauling the entire crop. As only a short crop was produced, respondent has only paid the cost of topping and hauling the short crop. As to the amount of beets not produced, respondent should have been allowed the price of these beets, as fixed by the contract, less the cost of producing them had they been produced, which would have included the cost of topping and hauling. It is evident that the trial court, in determining respondent's damage, failed to deduct from said price the cost which respondent would have been compelled to pay for topping and hauling said beets had they been produced. The judgment in respondent's favor was apparently excessive to the extent of $7,927.80. Deducting this amount from $16,162.19, the amount of the judgment would leave $8,234.39 as the amount due respondent. *752 But the mathematical calculations upon which this result is attained are not strictly correct. In the opinion of the trial court the deficit of beets produced is given as 3,692 tons and the price per ton as $7.77. Multiplying the tonnage by the price would give $28,686.84 instead of $27,756.44, a difference in favor of respondent of $930.40. Taking the sum of $28,686.84 as the correct price or value of the beets not produced and deducting from it the sum of $7,927.80, the cost of topping and hauling the extra crop, would leave $20,759.04 as the net loss to respondent for appellant's failure to properly plant and care for said crop of beets, and then deducting from this last-named amount said sum of $11,414.15, the amount found to be due appellant on its complaint herein, would leave $9,344.89 as the correct amount due respondent in this action. This result may be verified by the following calculation:
 Tabular Material Omitted
 The same result is obtained by the following calculation:
 Tabular Material Omitted
 By this method of fixing respondent's damages respondent receives the exact amount it would have received had the appellant farmed said land in accordance with the contract *753 under which it undertook to raise said crop of beets. To permit the judgment of the trial court to stand would be to award to respondent the sum of $6,817.30 more than it would be entitled to, with a corresponding detriment to the appellant. The judgment should therefore be modified by deducting from the amount thereof the said sum of $6,817.30, leaving the true amount of $9,344.89, for which sum judgment should be given in respondent's favor. The conclusion which we have reached is in strict accord with the previous decisions of this court and those of the District Court of Appeal, as will appear by the following reported cases: Lowe v. Yolo County etc. Water Co., 157 Cal. 503, 509 [108 P. 297], Teller v. Bay & River Dredging Co., 151 Cal. 209, 212 [90 P. 942, 12 Ann. Cas. 779, 12 L.R.A. (N. S.) 267], Rystrom v. Sutter Butte Canal Co., 72 Cal.App. 518, 521 [249 P. 53], and Chrisman v. Southern California Edison Co., 83 Cal.App. 249, 274 [256 P. 618].
 The two remaining points upon which the appellant relies were given quite extended discussion by the District Court of Appeal. We agree with the conclusion reached by said court in the discussion of these points as appears from the following portion of its opinion, which we adopt as the concluding part of the opinion of this court:
 [9] "Appellant claims the court erred in failing to allow interest on the unpaid balance of expenditures from October 31, 1925, asserting interest was chargeable both by the terms of the contract and by operation of law. The court found that at the end of the harvest time in 1925 appellant was entitled to a credit of $11,414.15 against respondent on account of farming operations under said contract, and at the trial found and liquidated the damages on the counterclaim in the sum of $27,756.44, and gave judgment in favor of respondent for the difference between those two sums without allowing any interest during the interim on the amount of expenditures under the contract. The contract provided that 'any money advanced, work performed, seed furnished, or any other charges to the account of said first party [Hollister Estate Company] will be paid by first party, and the second party may deduct the same, if approved in writing by the first party, before making payments on said beets. When advances are made by second party for the purposes hereof to be charged to *754 first party, first party shall be charged with interest thereon at seven per cent per annum from monthly statement to payment.' It is also provided that 'second party will render monthly statement to first party, covering charges for the preceding month'. These provisions appear to render it doubtful whether interest was to be charged on any item except 'money advanced', as distinguished from the other items in the monthly statement of 'charges'. In such case contemporaneous construction by the parties may be resorted to as the best means of solution. (Civ. Code, sec. 3535; 6 Cal.Jur. 304, 305.) The audit of the books of account kept by appellant, and the monthly statements rendered, in evidence herein, show that interest was charged only on money advanced as distinguished from other charges. This is sufficient to resolve the doubt and warrant an interpretation of the contract which would limit interest to items of money advanced and exclusive of other charges. Such interest was included in the balance found due."
 [10] "It is further claimed by appellant that interest thereon at the legal rate should have been added to the amount of expenditures found unpaid in October, 1925, on the ground that such amount of contract expenditures was capable of exact computation and therefore bears interest from the date the amount is due. (Civ. Code, secs. 3287 and 3302.) The general rule with respect to allowance of interest, when there is no contract to pay interest, is that the law awards interest upon money from the time it becomes due and payable, if such time is certain and the sum is certain or can be made certain by calculation. (Cox v. McLaughlin, 76 Cal. 60 [18 P. 100, 9 Am.St.Rep. 164]; Gray v. Bekins, 186 Cal. 389 [199 P. 767]; Perry v. Magneson, 207 Cal. 617 [279 P. 650].) The question whether the claim of appellant, under the tests laid down in the above cases, is, in contemplation of law, a liquidated or unliquidated demand, becomes unnecessary for decision herein, in the light of the law which applies to this case. For we hold that even though, under such tests, appellant's claim was a liquidated demand in October, 1925, it was subject to reduction by virtue of the unliquidated claim of respondent and must therefore be deemed to be an unliquidated sum upon which interest is not recoverable, [11] under the rule that in cases such as here presented, where *755 the deduction is for defective workmanship or defective husbandry under a contract, the court may properly allow interest only on the balance found to be due on the contract after deduction of such damages when liquidated, on the theory that the contractor is entitled to interest only on such amount, of the use of which he has been deprived during the period of default, because it is to that extent only that he has been damaged. (Hansen v. Covell, 218 Cal. 622 [24 PaCal.2d 772, 89 A.L.R. 670].) As the amount of damages in the instant case exceeds appellant's demand, there remains nothing on which to compute or allow interest."
 "We have examined appellant's assignments of error claimed to have occurred in ruling on the admissibility of evidence, and find no error in any of such rulings."
 For the reasons expressed herein, the judgment is modified by reducing the amount thereof from the sum of $16,162.19 to the sum of $9,344.89, and as so modified, said judgment is affirmed. Appellant to recover its costs.
 Langdon, J., Shenk, J., Thompson, J., Preston, J., Seawell, J., and Waste, C.J., concurred.
