The hard part is not slicing time, it is deciding which clock to slice by. Processing time is when an event reaches the processor. Event time is when the event actually happened, carried as a timestamp inside the record. Networks delay things and mobile devices go offline, so an event stamped 12:00 can arrive at 12:03. If you bucket by processing time you put it in the wrong window.
Serious stream engines window by event time and use watermarks to handle the lag. A watermark is a marker that says "I believe I have now seen all events up to time T". When the watermark passes a window's end, the engine knows the window is complete and emits the result. Watermarks are usually heuristic, computed as the max event time seen minus a fixed delay for out of order events, like 10 seconds.
Events that arrive after the watermark are late. You choose how to handle them: drop them, send them to a side output for separate processing, or let the window stay open a bit longer and re-emit a corrected result. This is the classic trade-off in windowing. Wait longer and you get more correct, more complete results but higher latency. Close fast and you get low latency but risk dropping stragglers.
Because a window holds state until it closes, windowing costs memory. Sliding windows are the most expensive since one event lives in many overlapping windows, and very large or very long windows can blow up state size. Engines mitigate this with incremental aggregation, keeping a running sum per window instead of storing every raw event.