~ubuntu-branches/ubuntu/natty/gnome-dvb-daemon/natty

« back to all changes in this revision

Viewing changes to src/Timer.vala

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2009-11-19 15:55:34 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20091119155534-lky88n43jb0htalm
Tags: 0.1.13-1
* New upstream release:
  + debian/control.in:
    - Update build dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    
29
29
        public uint32 Id {get; construct;}
30
30
        public Channel Channel {get; construct;}
31
 
        public string? Name {get; set;}
32
 
        // TODO Create values from starttime
33
 
        public uint Year {get; set;}
34
 
        public uint Month {get; set;}
35
 
        public uint Day {get; set;}
36
 
        public uint Hour {get; set;}
37
 
        public uint Minute {get; set;}
38
31
        public uint Duration {get; set;}
39
32
        public Gst.Element sink {get; set;}
40
33
        public uint EventID {get; set;}
42
35
        private Time starttime;
43
36
        
44
37
        public Timer (uint32 id, Channel channel,
45
 
        int year, int month, int day, int hour, int minute, uint duration,
46
 
        string? name=null) {
47
 
            this.Id = id;
48
 
            this.Channel = channel;
49
 
            this.Name = name;
50
 
            
51
 
            this.Year = (uint)year;
52
 
            this.Month = (uint)month;
53
 
            this.Day = (uint)day;
54
 
            this.Hour = (uint)hour;
55
 
            this.Minute = (uint)minute;
 
38
        int year, int month, int day, int hour, int minute, uint duration) {
 
39
            base (Id: id, Channel: channel);
 
40
 
56
41
            this.EventID = 0;
57
42
           
58
43
            this.Duration = duration;
165
150
        public void add_to_start_time (int minutes) {
166
151
            this.starttime.minute += minutes;
167
152
            this.starttime.mktime ();
168
 
            
169
 
            this.Year = this.starttime.year + 1900;
170
 
            this.Month = this.starttime.month + 1;
171
 
            this.Day = this.starttime.day;
172
 
            this.Hour = this.starttime.hour;
173
 
            this.Minute = this.starttime.minute;
174
153
        }
175
154
              
176
155
        public uint[] get_start_time () {
177
156
            uint[] start = new uint[] {
178
 
                this.Year,
179
 
                this.Month,
180
 
                this.Day,
181
 
                this.Hour,
182
 
                this.Minute
 
157
                this.starttime.year + 1900,
 
158
                this.starttime.month + 1,
 
159
                this.starttime.day,
 
160
                this.starttime.hour,
 
161
                this.starttime.minute
183
162
            };
184
163
            return start;
185
164
        }
234
213
        }
235
214
        
236
215
        public string to_string () {
 
216
            uint[] start = this.get_start_time ();
237
217
            return "channel: %u, start: %04u-%02u-%02u %02u:%02u, duration: %u".printf (
238
 
                this.Channel.Sid, this.Year, this.Month, this.Day, this.Hour,
239
 
                this.Minute, this.Duration);
 
218
                this.Channel.Sid, start[0], start[1], start[2], start[3],
 
219
                start[4], this.Duration);
240
220
        }
241
221
        
242
222
        private time_t get_end_time_timestamp () {