GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - selfmadecode/SlaCore: A lightweight and flexible .NET library for calculating Service Level Agreement (SLA) due dates, tracking compliance, and handling complex business calendars.

BranchesTags
Open more actions menu

Latest commit

 

History

36 Commits
36 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs
docs
 
 
src
src
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
SlaCalculator.sln
SlaCalculator.sln
 
 
icon.jpg
icon.jpg
 
 

Repository files navigation

SlaCore

SlaCore on NuGet

SlaCore is a lightweight .NET library for calculating SLA deadlines and evaluating SLA status. It supports wall-clock and business-hours SLAs with features like:

  • Predefined priority levels (Critical, High, Medium, Low)
  • Custom SLA durations
  • Configurable business hours and business days
  • Holiday exclusions
  • Warning thresholds and SLA status evaluation
  • Custom business rules

The library targets netstandard2.0 and can be used from modern .NET applications.

Installation

Install from NuGet:

dotnet add package SlaCore

Or reference the package in your project file:

<PackageReference Include="SlaCore" Version="1.0.0" />

Quick start

Create a predefined policy and calculate a deadline:

using SlaCore;
using SlaCore.Models;

var startedAt = DateTimeOffset.UtcNow;
var policy = SlaPolicy.High();
var deadline = SlaCalculator.CalculateSlaDeadline(startedAt, policy);
Console.WriteLine($"SLA deadline: {deadline}");

SlaPolicy.High() defaults to a 4-hour allowed duration.

Predefined policies (defaults):

Policy Default duration
Critical 1 hour
High 4 hours
Medium 8 hours
Low 24 hours

Evaluating SLA status

var result = SlaCalculator.Evaluate(startedAt, policy);
Console.WriteLine($"Status: {result.Status}");
Console.WriteLine($"Elapsed: {result.ElapsedTime}");
Console.WriteLine($"Deadline: {result.Deadline}");

Status values:

  • SlaStatus.OnTrack
  • SlaStatus.AtRisk
  • SlaStatus.Breached

By default, AtRisk is reached when WarningThreshold (0.80) of the allowed duration has elapsed.

Business rules (wall-clock vs business time)

Set UseBusinessHoursOnly = true to apply business-days, business-hours, and holiday rules. When false, SLAs use continuous wall-clock time.

Examples and detailed explanations are available in the docs/ folder:

  • Business rules
  • Examples
  • Policies

Real-life scenario: Helpdesk ticket SLA

Scenario:

  • A helpdesk creates a ticket at 2026-09-02T16:00 (local time).
  • The customer has a High SLA (4 hours) and the team operates Monday–Friday, 09:00–17:00.
  • The next business day is Tuesday at 09:00 (because Monday is a holiday).

Calculation (business hours):

  • Day 1: Thursday 16:00 → 17:00 = 1 hour
  • Day 2: Friday is a holiday (0 hours)
  • Weekend: 0 hours
  • Monday: holiday (0 hours)
  • Tuesday 09:00 → 12:00 = 3 hours
  • Deadline: Tuesday 12:00

Code to configure the policy:

var policy = SlaPolicy.High(
    businessHoursOnly: true,
    configure: p =>
    {
        p.BusinessHoursStart = TimeSpan.FromHours(9);
        p.BusinessHoursEnd = TimeSpan.FromHours(17);
        p.BusinessDays = new List<DayOfWeek>
        {
            DayOfWeek.Monday,
            DayOfWeek.Tuesday,
            DayOfWeek.Wednesday,
            DayOfWeek.Thursday,
            DayOfWeek.Friday
        };
        p.Holidays = new List<DateTime> { new DateTime(2026, 9, 6), new DateTime(2026, 9, 7) };
    });

API overview

Key types:

  • SlaPolicy — defines allowed duration and business rules (AllowedDuration, UseBusinessHoursOnly, BusinessHoursStart, BusinessHoursEnd, BusinessDays, Holidays, WarningThreshold).
  • SlaCalculator.CalculateSlaDeadline(startedAt, policy) — computes the deadline.
  • SlaCalculator.Evaluate(startedAt, policy) — returns SlaResult with Status, Deadline, ElapsedTime.

Use cases

  • Helpdesk and support ticket SLAs
  • Incident management
  • Customer response-time monitoring
  • Internal service requests and compliance tracking

Development

Build the solution:

dotnet build

License

MIT — see LICENSE.txt.

About

A lightweight and flexible .NET library for calculating Service Level Agreement (SLA) due dates, tracking compliance, and handling complex business calendars.

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.