An expression meaning 'before I knew it' or 'when I came to,' used when you suddenly realize something after some time has passed.
気がつくと外はもう暗くなっていた。
Before I knew it, it was already dark outside.
彼と話しているうちに、気がつくと時間が過ぎていた。
While talking with him, before I knew it time had passed.
電車で寝ていて、気がつくと終点だった。
I fell asleep on the train and, when I woke up, it was the last stop.
気がつくと、いつも同じ道を歩いている自分がいる。
I find myself, before I know it, always walking the same route.