From 15361bd995a08b3788b56289ec89dfb80ceac160 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Sat, 9 Sep 2023 01:13:54 +0200 Subject: TODOs n stuff --- src/time.odin | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/time.odin b/src/time.odin index 853aa95..468f5d8 100644 --- a/src/time.odin +++ b/src/time.odin @@ -385,6 +385,10 @@ importICS :: proc(path: string) -> ([dynamic]Timeblock, bool) { } for line in strings.split_lines_iterator(&content) { + + // BUG: This assumes that there will never be a line shorter than 10. + // That means this will try reading out of bounds at some point. + if line[0:10]=="DTSTART;TZ" { // grab the timestamp from the end of the line, and set start to it @@ -436,12 +440,21 @@ importICS :: proc(path: string) -> ([dynamic]Timeblock, bool) { c.end.year = strconv.atoi(line[ll-15:ll-11]) } + + // TODO: This is checking if the years are 0 to make sure it hasn't read from + // from a line containing "DTSTART;VALUE" instead of "DTSTART;TZID" + // VALUE days are events that are set to last the entire day, + // as opposed to having a defined start and end point. + // + // This should eventually not be needed, because these days + // should also be imported based on the session's default-day settings + if line=="END:VEVENT" && (c.end.year != 0) && (c.start.year != 0) { fmt.println(line) c.value = 1 append(&output, c) + blank_timeblock: Timeblock - c = blank_timeblock fmt.println("\n\n", i, line_nr, "\n\n") -- cgit v1.2.1