import * as tsplus_module_1 from "@effect/core/io/Clock/operations/currentTime";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Duration";
import * as tsplus_module_3 from "@effect/core/stream/Sink/operations/summarized";
import * as tsplus_module_4 from "@effect/core/stream/Sink/operations/drain";
import * as tsplus_module_5 from "@effect/core/stream/Sink/operations/map";
export const withDuration = withDuration_1;
/**
 * Returns the sink that executes this one and times its execution in
 * milliseconds.
 *
 * @tsplus fluent ets/Sink timed
 */

function withDuration_1(self, __tsplusTrace) {
  return tsplus_module_3.summarized_(self, () => tsplus_module_1.currentTime, (start, end) => new tsplus_module_2.Duration(end - start), __tsplusTrace);
}
/**
 * Times the execution of a sink in milliseconds.
 *
 * @tsplus static ets/Sink/Aspects timed
 */


export function timed(__tsplusTrace) {
  return tsplus_module_5.map_(withDuration_1(tsplus_module_4.drain(__tsplusTrace), __tsplusTrace), tuple => tuple.get(1), __tsplusTrace);
}
//# sourceMappingURL=timed.mjs.map