Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void add(char* time1, char* time2){
- num_seconds_t seconds1, seconds2, total;
- struct time_spec_t *spec1 = malloc(sizeof(spec1));
- struct time_spec_t *spec2 = malloc(sizeof(spec2));
- struct time_spec_t *total_time = malloc(sizeof(total_time));
- if ((is_legal_seconds(time1))) {
- seconds1 = string_to_seconds(time1);
- } else if ((is_legal_time_spec(time1))) {
- spec1 = string_to_time_spec(time1);
- seconds1 = time_spec_to_seconds(spec1);
- } else {
- //error
- }
- if ((is_legal_seconds(time2))) {
- seconds2 = string_to_seconds(time2);
- } else if ((is_legal_time_spec(time2))) {
- spec2 = string_to_time_spec(time2);
- seconds2 = time_spec_to_seconds(spec2);
- } else {
- //error
- }
- total = seconds1 + seconds2;
- if (total < 3155760000){
- total_time = seconds_to_time_spec(total);
- print_time_spec(total_time);
- exit(0);
- } else {
- fprintf(stderr,"Error adding time");
- exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement