Пример #1
0
    public void CalTimeDuration(_TCTime tme)
    {
        _TCTime end = new _TCTime();

        // สลับเวลามาก มาไว้ที่ ตัวเอง(this)  เวลาน้อย ไปไว้ที่ end
        if (this.CompareWith(tme)>=0)
        {
            end.SetTimeTo(tme);
        }
        else
        {
            end.SetTimeTo(this);
            this.SetTimeTo(tme);
        }
        // ลบเวลา
        this.hour -= end.hour;
        this.min -= end.min;
        // ปรับ ชม./นาที
        if (this.min<=0)
        {
            this.hour--;
            this.min += 60;
        }
        if (this.hour < 0)
        {
            this.hour = 0;
        }
    }